fill in fields in a form (1 Viewer)

elamberton

New member
Local time
Today, 11:29
Joined
Jan 11, 2000
Messages
5
Public Sub SearchField3(Find As String, Co As String)
Dim strSQL As String
Dim db As Database
Dim rs As Recordset
strSQL = "Customers"
Set db = CurrentDb()
Set rs = db.OpenRecordset(strSQL)
With rs
Do While rs.NoMatch = True
.MoveNext
.FindFirst "CustomerID = '" & Find &"'"
Loop
Co = rs!CompanyName
End With
End Sub
this is the function I have written to fill in the Co feild. However, it doesn't work. Any suggestions? It doesn't give me any errors when I run the code.
 

Travis

Registered User.
Local time
Today, 03:29
Joined
Dec 17, 1999
Messages
1,332
try .MoveFirst vice .MoveNext

If you are using search there is no need to move the the next record but a search will only start from the record it's on to the end of the recordset.
 
E

Eric

Guest
Try this:
Set rs = db.OpenRecordset(strSQL, dbOpenDynaset)
 

elamberton

New member
Local time
Today, 11:29
Joined
Jan 11, 2000
Messages
5
Thanks for all your help. Got the thing to work with dbOpenSnapShot.
Happy Coding to all.
Ed
 

Users who are viewing this thread

Top Bottom