Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to have a search field that will cause form to populate with recor

Status
Not open for further replies.

jcnoble

IS-IT--Management
Jan 16, 2003
3
US
I am a newbie to this site and access so please forgive me if I don't do this totally correctly.

I have a table -tblPartNumbers - which list a desc and four fields with part numbers for that description which different companies use for that part, i.e. Widget; 02.3659.33; UC20003699; 04.2222.002;3lk99. All Part numbers are unique, there are NO duplicate numbers anywhere.

I used autoform to create a form - frmPartNumber - which showed five fields: Description, Company ABC part number, Company 123 part number, Company XYZ part number & Company 789 part number.

What I would like to do and NEED HELP doing, is put a search field in the form -frmPartNumber -such that I could type in a part numberin search field and the five fields of information for the record with that part number in it would then populate my frmPartNumber form. This is like the "by example" LookUp in the software program Called ACT.

Thank you in advance for your help.

Charles
 
This code should help you get started. You are in the wrong forumn though. Get in the "forms" or "VB Code" forum.

If any help be sure and click stars to the helper. That is what we use as ACCESS "Candy"

Private Sub txtFindr_Click()
Dim rs As DAO.Recordset, okay As Boolean

If IsNull(Me.Text22) Then
MsgBox "You input a NULL string."
Exit Sub
End If
okay = False
Set rs = Me.RecordsetClone
If rs.EOF And rs.BOF Then
MsgBox "No Records in the 'DESC' database."
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.MoveLast
rs.MoveFirst
Do While Not rs.EOF

If InStr(rs![DESCR], Me.Text22) > 0 Then
okay = True
Exit Do
End If
rs.MoveNext
Loop
If okay Then
Me.Bookmark = rs.Bookmark

Else
MsgBox "I did not find your string in any 'Decsription.'"
End If
Me.Text22 = ""

rs.Close
Set rs = Nothing

End Sub

Rollie@bwsys.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top