Combo Box selection triggers new form

T

Timone

I have a Main form with a combo box that contains a list
of medications. Depending on the medication selected, I
would like a new form to appear that links the current
record information.

For example, a combo box selection is made for John Doe in
the main form. The selection made is one which triggers
the new form. Once the new form appears, it already has
John Doe's demographic information included.

I would appreciate any help I can get with this. I've
tried a few tricks but I have not been successful thus
far. Thanks!
 
J

Jonathan Parminter

-----Original Message-----
I have a Main form with a combo box that contains a list
of medications. Depending on the medication selected, I
would like a new form to appear that links the current
record information.

For example, a combo box selection is made for John Doe in
the main form. The selection made is one which triggers
the new form. Once the new form appears, it already has
John Doe's demographic information included.

I would appreciate any help I can get with this. I've
tried a few tricks but I have not been successful thus
far. Thanks!

.
Hi Timone,

the new form will need to have a recordsource that
includes the table with John Doe's information and primary
key field. The combobox will need to include this primary
key. Have the combobox_AfterUpdate() event to open the new
form to John Doe's information using the WhereCondition
argument of the docmd.Openform method.

For example.
combobox name: cboClientID
primary key field name: ClientID
combobox bound column is primary key field
new form name: myForm

Private Sub cboClientID_AfterUpdate()
docmd.openform FormName:="myForm", _
WhereCondition:="ClientID=" & cboClientID, _
WindowMode:=acDialog
End sub

Luck
Jonathan
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top