Hi
For the example you gave the cod would be something like
If (Forms!MainForm!SubForm!ListBox = "SomeText ") Then
DoCmd.OpenForm "Query_Bookings_4Pks_DropOff", acNormal, "",
"[FieldNameOnFormOrReport]=[Forms]![MainForm]![SubForm].[Form]![FieldName]",
acEdit, acNormal
End If
Basically you can use the on Click event of your list box for many criteria
- something like this
Private Sub ListBoxName_Click()
If (Forms!FormName!ListBoxName = "Something1") Then
DoCmd.OpenReport "ReportName", acViewNormal, "",
"SetCriteriaIfWantedHereâ€
End If
If (Forms!FormName!ListBoxName = "Something2") Then
DoCmd.OpenForm "FormName", acViewNormal, "", "SetCriteriaIfWantedHereâ€
End If
If (Forms!FormName!ListBoxName = "Something1") Then
DoCmd.OpenReport "ReportName", acViewNormal, "",
"SetCriteriaIfWantedHereâ€
End If
Etc
Etc
etc
End Sub
The criteria would be something ike this – if you need to restrict the form
/ report that want to open – you could use a ield on the form the set the
filter
Hope this helps
--
Wayne
Manchester, England.
Enjoy whatever it is you do
Ramtin said:
Hi
On my first form I have a drop-down box and I want if user selects specific
value, access opens my second from, I tried following code but not working:
DoCmd.OpenForm "prc frm", , , , , , Reason_for_visit = [Procedure]
my second from field on first form specific
value