Combo Box

  • Thread starter Thread starter Hesham Sakr
  • Start date Start date
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??
 
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
 
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??
 
Back
Top