Command Button Set Value after opening form

Chillendw

Registered User.
Local time
Today, 05:32
Joined
Mar 1, 2017
Messages
38
Hey all,

I was wondering if this is possible or if there is probably an easier way to do this.

I have a form with 2 command buttons, depending on which button is pressed, it will open a corresponding form:
RECEIVE --> frmReceive
SALE --> frmSale

These both feed to the same table but have different fields on each form. In the table I have a TransactionType field which is either "Receive" or "Sale." I was wondering if it were possible to add the value of "Receive" or "Sale" to the form from the On Click event of each button. i.e., if the click the RECEIVE command button, frmReceive opens and the field TransactionType is populated with "Receive" (this is hidden from the user).

Or should/can I simply set the field on each form to it's corresponding type ("Receive" or "Sale") once the second form is opened?

Thanks in advance.
 
Personally, I would have the After Update event on the TypeTransaction field (ideally a Combo/List Box) trigger which form is opened.

This would preclude some issues and eleiminate the need for additional coding. For example, what it someone populated the field with "Receive" but then clicked the "Send" button? You would have to write code to handle that user error.
 
I'd add a text box to each form, hidden or not, bound to your TransactionType field. Set the default value in this text box in the Sale form to 'Sale' (or the corresponding index) and similarly for the other form.
 

Users who are viewing this thread

Back
Top Bottom