I followed the code in the link and an error comes up, the error being "RUN
TIME ERROR '424'
OBJECT REQUIRED".
the code i entered was:
Private Sub Combo4_Click()
Dim strReportName As String
Dim strCriteria As String
If NewRecord Then
MsgBox "This record contains no data." _
, vbInformation, "Invalid Action"
Exit Sub
Else
strReportName = [Combo4]
strCriteria = "[Combo4] =" & Me![Combo4] & ""
DoComd.OpenReport strReportName, acViewPreview, strCriteria
End If
End Sub
on Debug it highlighted the "DoCmd line". i used [Combo4] as the report
name as i have a list of reports to choose from and the one i want to select
is defined by what is selected in the combo box. what am i doing wrong.
:
Look at this link on "Printing the Record on the Microsoft Access Form to a
Report"
http://www.databasedev.co.uk/report_from_form_record.html
In addition, if the filter is on a text field, change the filter adding
single quote for a string
This line:
strCriteria = "[lngSalespersonID]= " & Me![lngSalespersonID]
will turn into
strCriteria = "[lngSalespersonID]= '" & Me![lngSalespersonID] & "'"
--
Good Luck
BS"D
:
I have a form with 1 combo box on it. on the drop down menu there are a
number of names. when a specific name is selected how do i get it to open
thr report corresponding to that name i.e. when "Jane" is selcted from the
list, the report "jane opens"