Before Update help (1 Viewer)

stevemccauley

Registered User.
Local time
Today, 05:22
Joined
Aug 8, 2001
Messages
75
I have 1 form that records transactions. If it is opened from "FormA", then I want the textbox "RefNbrA" on formA to be recorded to my transactions form, If it is opened from "FormB", then I want the textbox "RefNbrB" on FormB to be recorded to my transaction form.

How can I do this?
 

Travis

Registered User.
Local time
Yesterday, 21:22
Joined
Dec 17, 1999
Messages
1,332
Use the OpenArgs property to determine which form opened your trans form.

Or

Create a global variable that gets set on just before you open the Trans form.
 

stevemccauley

Registered User.
Local time
Today, 05:22
Joined
Aug 8, 2001
Messages
75
How do I use OpenArgs to determine with form opened my transaction form? Can you get me an example?
 

DBL

Registered User.
Local time
Today, 05:22
Joined
Feb 20, 2002
Messages
659
I'm assuming that Forms A and B remains open when the transaction form is opened:

On the event that opens the transaction form from Form A:

DoCmd.openform "transactionform",,,,,,1

On the event that opens the transaction form from Form B:

DoCmd.openform "transactionform",,,,,,2

On the OnOpen event of the transaction form

If Not IsNull (Me.openargs) then
Select Case Me.openargs

case 1

Me.fieldontransactionform = Forms!transactionform![RefNbrA]

Case 2

Me.fieldontransactionform = Forms!transactionform![RefNbrB]

End Select
End if

Give that a go and see how you get on. Come back if you're stuck.
 

Users who are viewing this thread

Top Bottom