Passing data from form to form via macro

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Greetings,
I am developing an application where the user needs to choose their name
from a combo box on one form, and then transfer that selection to be their
default selection for their entire session on a second form. Can this be
done? Or should I be using a subform instead?

Thanks,
DKB
 
It's very difficult to give you advice here because we don't know what is
being done on the second form, nor do we know what a "session" entails.

In general,

-- one makes a selection in a combo box (unbound) in a form's header,
and then lets that combo box's value be used by the form's RecordSource; or

-- one makes a selection in a combo box (unbound) in a form's header,
and then lets that combo box's value be used by a subform (via
LinkChildFields and LinkMasterFields properties);

-- or the scenario that you've suggested also can be used.
 
Ken,

Sorry for being so vague. The application is for a cashier. The form is cash
register style, with basic header information: Cashier, Customer, Trans#,
Date. It has two subreports: Order Lines and Payment Lines.

What I am looking to do is that once the form has been opened in an add
mode, that the first selected cashier will become the default when they
finish the transaction, and begin the next one.

Currently, when they select the 'Finish' command button, which calls a macro
to complete the transaction, it goes back to a blank combo box for cashier
selection.

Basically I am trying to make this as easy as possible. This is for a
charity boutique, and the cashiers do not do this professionaly.

Thank You,

DKB
 
Assuming that the form stays open, you can use the AfterUpdate event of the
combo box to change the Default Value of the combo box for the next new
record:

Private Sub ComboBoxName_AfterUpdate()
Me.ComboBoxName.DefaultValue = """" & _
Me.ComboBoxName.Value & """"
End Sub

--

Ken Snell
<MS ACCESS MVP>
 
Ken,

Thanks! Now I see why you are an MVP!

DKB

Ken Snell said:
Assuming that the form stays open, you can use the AfterUpdate event of the
combo box to change the Default Value of the combo box for the next new
record:

Private Sub ComboBoxName_AfterUpdate()
Me.ComboBoxName.DefaultValue = """" & _
Me.ComboBoxName.Value & """"
End Sub
 
< grin > I actually learned this "trick" right here on the newsgroups.....
You're welcome.
 
Back
Top