D
Dave Elliott
I have module that is called from my form to open another form with specific
criteria.
Here is an example of what I am trying to do;
I need to open my form named TimeCards from the main form named
frmAutoPayrollReport which uses unbound
drop down list boxes for criteria.
I placed the control / field in my query name Due and on the form.
If the control Due is true, then the record Needs to be invoiced.
Also if (Due) is true then I need to open TimeCards and show all records
that Due (Value) is true.
Dim db As DAO.Database
Dim qd As QueryDef
Dim Mywhere As Variant, Var1 As Variant
Var1 = [Forms]![frmAutoPayrollReport]
Set db = DBEngine.Workspaces(0).Databases(0)
On Error Resume Next
db.QueryDefs.Delete ("QDynamicQuery")
On Error GoTo 0
Mywhere = Null
Mywhere = Mywhere & (" And [Due] Like '" + Var1![Status].Column(0) + "'")
Set qd = db.CreateQueryDef("QDynamicQuery", "Select * From QDates " &
("Where " + Mid(Mywhere, 6) + "ORDER BY [TimeCounter] ASC ;"))
DoCmd.OpenForm "TimeCards"
criteria.
Here is an example of what I am trying to do;
I need to open my form named TimeCards from the main form named
frmAutoPayrollReport which uses unbound
drop down list boxes for criteria.
I placed the control / field in my query name Due and on the form.
If the control Due is true, then the record Needs to be invoiced.
Also if (Due) is true then I need to open TimeCards and show all records
that Due (Value) is true.
Dim db As DAO.Database
Dim qd As QueryDef
Dim Mywhere As Variant, Var1 As Variant
Var1 = [Forms]![frmAutoPayrollReport]
Set db = DBEngine.Workspaces(0).Databases(0)
On Error Resume Next
db.QueryDefs.Delete ("QDynamicQuery")
On Error GoTo 0
Mywhere = Null
Mywhere = Mywhere & (" And [Due] Like '" + Var1![Status].Column(0) + "'")
Set qd = db.CreateQueryDef("QDynamicQuery", "Select * From QDates " &
("Where " + Mid(Mywhere, 6) + "ORDER BY [TimeCounter] ASC ;"))
DoCmd.OpenForm "TimeCards"