Query Results in Form View

S

Sharon

I have created a form in which data can be entered into a table. I have also
designed a query which asks the user to input information such as name, date
of birth, record number. When the query finds that record, it opens in the
datasheet view. I however, would like it to open the results in the form view
of the initial form that the data was entered. I have no idea how to do this.
I have tried everything and am at a stand still. Any help would be
appreciated.

I have already tried duplicating the form and having it's record source be
the query. I figured that would work but of course...it hasn't. So I need
help.
 
D

Damon Heron

I would simplify it by adding a combobox to the header of your form, with
the row source your table.
The user can either search or type in the search name. Then in the
afterupdate event of the combobox (called cbxFind here), have code like
this:

Private Sub cbxFind_AfterUpdate()
' Find the record that matches the control.
On Error GoTo Err_cbxfind_AfterUpdate
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[tblCustomers].[CustomerID] = " & str(Nz(Me![cbxFind], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
Exit_cbxFind_AfterUpdate:
Exit Sub
Err_cbxfind_AfterUpdate:
MsgBox Err.Description
Resume Exit_cbxFind_AfterUpdate
End Sub

If you aren't familiar with how to set up the columns, etc of comboboxes,
post further.

Damon
 

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