Pretty new to Access so bare with me. Have a table of fields and I need the form to ask the user to print a report based on the "BLOCK" field. I would like a pull down type box that makes the user select from all the different blocks. I have created what I thought would work but it does not
just gives me a compile error. Maybe someone could decipher this for me. Here is the event proceedure:
Private Sub Command0_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "Block Summary Report"
strField = "BLOCK"
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere
Me.Visible = False
If Not IsNull(Me.cboBlock) Then 'block combo box
strWhere = " AND [BLOCK] = """ & Me.cboBlock & """"
End If
End Sub
If there is a better way to do this that would be fine. I just thought a combo type box worked the easiest. I do not have a very through manual.
Thanks
Private Sub Command0_Click()
Dim strReport As String 'Name of report to open.
Dim strField As String 'Name of your date field.
Dim strWhere As String 'Where condition for OpenReport.
Const conDateFormat = "\#mm\/dd\/yyyy\#"
strReport = "Block Summary Report"
strField = "BLOCK"
' Debug.Print strWhere 'For debugging purposes only.
DoCmd.OpenReport strReport, acViewPreview, , strWhere
Me.Visible = False
If Not IsNull(Me.cboBlock) Then 'block combo box
strWhere = " AND [BLOCK] = """ & Me.cboBlock & """"
End If
End Sub
If there is a better way to do this that would be fine. I just thought a combo type box worked the easiest. I do not have a very through manual.
Thanks