Combo box selection to open a form and load the selected record de

G

Guest

I have a form that is built on a query and displays records based on query
results. Also have put a combo box which loads the list of the records and
the user can choose a record that he would like to see details of, following
is the code:

Private Sub Combo18_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[Type_ID] = " & Str(Nz(Me![Combo18], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Now I would like to open another form called “F_lookup†and then load the
selected record select above to automatically load the record details in this
new form.

Could someone help, thanks.
 
G

Guest

MSA,

How about this, instead:

Private Sub Combo18_AfterUpdate()

' Open new form showing selected record.

DoCmd.OpenForm "F_Lookup", , , _
"[Type_ID] = " & Nz(Me![Combo18], 0), acDialog

End Sub

In the Open event for F_Lookup you can test for a record being returned by
the filter and display an error message if none is found.

Bruce
 

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