RnRExpress
Technical User
Ok, I'm back and in need of more wonderful help from you folks.
I have a command button that automatically selects the record I am on, and prints out a specific report.
Here is what I have. I have a database where I have a field called "Location ID". There are 5 options in this text box's value list. And I have this one report, which are all identical, except the heading part which prints out the location's name, address, phone number and hour of operations.
I have a button on the form, which runs this code:
Private Sub Command209_Click()
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[Record ID] = " & Me.[Record ID]
DoCmd.OpenReport "Report1", acViewNormal, , strWhere
End If
Me.[2nd Notice] = Date
End Sub
what I would like to have, if its possible, is after I select this command button to print this report, have the program look at the field "Location ID" and if it sees R123 (for example), it will print "Report1". But if it sees X456, then it knows to print "Report2", and on and on.
I was experimenting trying to add some If, Else liens in, but ended up messing it all up.
I'd appreciate any help folks!
Thanks,
RIchard
I have a command button that automatically selects the record I am on, and prints out a specific report.
Here is what I have. I have a database where I have a field called "Location ID". There are 5 options in this text box's value list. And I have this one report, which are all identical, except the heading part which prints out the location's name, address, phone number and hour of operations.
I have a button on the form, which runs this code:
Private Sub Command209_Click()
If Me.Dirty Then 'Save any edits.
Me.Dirty = False
End If
If Me.NewRecord Then 'Check there is a record to print
MsgBox "Select a record to print"
Else
strWhere = "[Record ID] = " & Me.[Record ID]
DoCmd.OpenReport "Report1", acViewNormal, , strWhere
End If
Me.[2nd Notice] = Date
End Sub
what I would like to have, if its possible, is after I select this command button to print this report, have the program look at the field "Location ID" and if it sees R123 (for example), it will print "Report1". But if it sees X456, then it knows to print "Report2", and on and on.
I was experimenting trying to add some If, Else liens in, but ended up messing it all up.
I'd appreciate any help folks!
Thanks,
RIchard