Using Findfirst

Danryan

Registered User.
Local time
Today, 20:54
Joined
Feb 18, 2004
Messages
19
I have a question regarding the findfirst command.
Is there a way of setting a condition:
eg. WHERE boxno = list14 AND name = combo1
Could somebody please help?!
 
Danryan said:
I have a question regarding the findfirst command.
Is there a way of setting a condition:
eg. WHERE boxno = list14 AND name = combo1
Could somebody please help?!

The findfirst method comes with a where clause check. In your code I would set variables to the value in List14 and combo1 (in less List14 is a multiselect list box?).

Ok so here is some mock code for you:

Public Function FindFirstCodeSample()
Dim strBx14 As String
Dim strName As String
Dim rstRS As Recordset

strBx14 = Me.List14
strName = Me.combo1


' Need to be using DAO
Set rstRS = CurrentDb.OpenRecordset("YourQryorTableName", vbOpenDynaset)
rstRS.FindFirst ("boxno = '" & strBx14 & "' and name = '" & strName & "'")
If rstRS.NoMatch Then
...
End If
End Function
 
Thanks, but I'm afraid that doesn't work.
The listbox is a multiselect box.
The record I want it to find depends on the contents of 3 boxes:
combo1 (name), combo2 (filetype), list1 (box)
The findfirst needs to look at all three boxes to select a record.
The listbox can contain more than one value, and when the user
clicks on a value I want the other 3 text boxes to change
according the that particular selected record.
Can anybody help me with this?
 

Users who are viewing this thread

Back
Top Bottom