D
Dave Elliott
I have a master form named frmAutoPayrollReport from where I open the main
form named TimeCards.
Using a command button to lauch the code and unbound drop down list boxes
for criteria.
I need to open the form TimeCards so that it shows only records that have
not been Invoiced.
In the table from where the form TimeCards is based there is a field named
Due that is set to True/False and
the default being False.
If this control named Due is False, then it has not been Invoiced.
From the drop down list box if I choose Due from the list it needs to open
and show only records that Due is set to True,
i.e. Ready to Invoice
Also I am trying tio implement a If statement to make the control Due value
change to True
if the following code is true.
Me.Lbl383.Visible = Nz(Me.Text362, 0) = 0
In other words if Text362 equals 0 or isnull then Due equals True
A lookup module is being used right now for the other critera. Here is the
drop down list options.
'1';"Active";'2';"Archived";'3';"Due"
Here is the module code.
On Error GoTo LookUp_Err
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"
LookUp_Exit:
Exit Function
LookUp_Err:
MsgBox Error$
Resume LookUp_Exit
form named TimeCards.
Using a command button to lauch the code and unbound drop down list boxes
for criteria.
I need to open the form TimeCards so that it shows only records that have
not been Invoiced.
In the table from where the form TimeCards is based there is a field named
Due that is set to True/False and
the default being False.
If this control named Due is False, then it has not been Invoiced.
From the drop down list box if I choose Due from the list it needs to open
and show only records that Due is set to True,
i.e. Ready to Invoice
Also I am trying tio implement a If statement to make the control Due value
change to True
if the following code is true.
Me.Lbl383.Visible = Nz(Me.Text362, 0) = 0
In other words if Text362 equals 0 or isnull then Due equals True
A lookup module is being used right now for the other critera. Here is the
drop down list options.
'1';"Active";'2';"Archived";'3';"Due"
Here is the module code.
On Error GoTo LookUp_Err
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"
LookUp_Exit:
Exit Function
LookUp_Err:
MsgBox Error$
Resume LookUp_Exit