Search table column for value

Directlinq

Registered User.
Local time
Today, 11:02
Joined
Sep 13, 2009
Messages
67
Is it possible for me to search a table column for a value stored in a variable using an if statement.
eg if variable is in the the table column 1 then do this if not do this
Is it possible to do this completly in vba

Many Thanks
 
D,

You can use a DCount function:

Code:
If DCount("[ThatField]", "YourTable", "[ThatField] = 'Something') > 0 Then
   MsgBox "It exists."
   Exit Sub
End If

Wayne
 
This is what ive got
Code:
If DCount("[Name]", "TblVideo", "[Name] = 'songname') > 0 Then
   MsgBox "It exists."
   Exit Sub
End If

and it says
compile error
Expected: list seperator or )

What have i done wrong
 
D,

Code:
If DCount("[Name]", "TblVideo", "[Name] = 'songname'[B][SIZE="3"]"[/SIZE][/B]) > 0 Then
   MsgBox "It exists."
   Exit Sub
End If

Wayne
 

Users who are viewing this thread

Back
Top Bottom