Dlookup

R

Rick Brandt

Wavequation said:
can I use a SQL statement for the domain in dlookup?

No. A custom replacement that did though should not be too difficult to create.
 
O

Ofer Cohen

Or, Openning the recordSet already filtered Instead of using FindFirst

Set MyRec = MyDB.OpenRecordSet("Select * From TableName Where FieldName = 2")
If Not MyRec.Eof Then

.......
End If
 
W

Wavequation

Is that code using a dao database object?

Ofer Cohen said:
Or, Openning the recordSet already filtered Instead of using FindFirst

Set MyRec = MyDB.OpenRecordSet("Select * From TableName Where FieldName = 2")
If Not MyRec.Eof Then

.......
End If
 
O

Ofer Cohen

Need to declare the database and recordset

' Declaration
Dim MyDb as Dao.DataBase, MyRec as Dao.RecordSet
' Set to the current db
Set MyDb=CurrentDb()
' Open record set
Set MyRec = MyDB.OpenRecordSet("Select * From TableName Where FieldName = 2")
' check if any records returned
If Not MyRec.Eof Then
 
Top