Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open different invoice ?

Status
Not open for further replies.

neptunes

Technical User
Oct 21, 2002
6
GB
Hi i have two forms (Invoices)A and B invoice A opens as default would love to open invoice B with certain criteria so i put command below into the on open of in voice A
but still opens first at invoice A then when i click close it then opens invoice B any suggestions Cheers

Private Sub Form_Open(Cancel As Integer)
DoCmd.Maximize
If BPS_J_Q = "bpmq" Then
stDocName = "WM Invoice"
stLinkCriteria = "[Job No]=" & "'" & Me![Job No] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Else
If BPS_J_Q = "bpsj" Then
stDocName = "WM Invoice"
stLinkCriteria = "[Job No]=" & "'" & Me![Job No] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
End If
End If
End Sub
 
The Open event of Invoice A is not a good place to change to Invoice B. You could use the Load event of Invoice A if you want to open Invoice B as well as Invoice A. You cannot refer to controls - Me![Job No] - in the Open event as they have not been created yet. If you want to decide which invoice to open, you should do it in earlier code, from the menu, for example.

Both parts of the code above refer to the same form: stDocName = "WM Invoice".
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top