Create a lookup

A

Andrew H

I want to create a form that allows me to enter a Workorder number in a
form and then the corresponding information from a table would be shown
in the subform. Can someone give me a start on how to go about this?

eg if I type in 1000, the subform would pull up the job description and
appointment date that is stored for job no 1000 on the workorders
table.

The Workorder number is the primary key on the workorders field.

Sorry for the really basic question but I can't seem to get it working
at all.
 
A

Andrew H

Sorry to reply to my own e-mail but I eventually found it in the Access
VBA Help pages.

This does the trick

Private Sub Text4_AfterUpdate()
Dim rst As Recordset
Dim strSearchName As String

Set rst = Me.RecordsetClone
strSearchName = Str(Me!WorkorderID)
rst.FindFirst "WorkorderID = " & strSearchName

If rst.NoMatch Then
MsgBox "Record Not Found"
Else
Me.Bookmark = rst.Bookmark
End If
rst.Close
End Sub

Slightly more complicated than what I am used to.
 

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