Combo Box

H

Hesham Sakr

Hi,

I want to put a combo box on a form the lists values (PK) of records on
another form. I want to know how when I select a value from the combo box it
can open that other form on the specific record i selected its PK??
 
J

John W. Vinson

Hi,

I want to put a combo box on a form the lists values (PK) of records on
another form. I want to know how when I select a value from the combo box it
can open that other form on the specific record i selected its PK??

See the VBA help for the "OpenForm" method. One of its arguments is a
WhereCondition; you can use the AfterUpdate event of the combo to open the
other form, something like

Private Sub mycombo_AfterUpdate()
Dim strDocument As String
Dim strCriteria As String
strDocument = "FormYouWantToOpen"
strCriteria = "[PKFieldname] = " & Me!mycombo
DoCmd.OpenForm strDocument, WhereCondition := strCriteria, <other options>
End Sub
 
D

De Jager

Hesham Sakr said:
Hi,

I want to put a combo box on a form the lists values (PK) of records on
another form. I want to know how when I select a value from the combo box
it
can open that other form on the specific record i selected its PK??
 

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