Help with sql

blackie1982

Registered User.
Local time
Today, 08:10
Joined
Jul 2, 2004
Messages
18
Here's my code to try and select some data from a table. The three fields I have are all of the data type yes/no so they have a check box as their values. How do I get that value into variable using sql?
Heres my code so far, but it is giving me a data type mismatch.
Please Help


Dim stDocName As String
Dim stLinkCriteria As String
Dim sqlStatement As String
Dim elec As Integer
Dim greater2hrs As Integer
Dim less2hrs As Integer

sqlStatement = "SELECT faults.greaterThan2hrs, faults.lessThan2hrs, electrical FROM faults WHERE (((faults.tagNo)= '" & Forms![rectifySearch]![tagText] & "'));"
Set db = Application.CurrentDb
Set RSRecord = Nothing
Set RSRecord = db.OpenRecordset(sqlStatement)
 
myVariable = RSRecord("myFieldname")
 
Make sure you dimension RSRecord too.
 
If you didn't understand what he meant, he meant this:

Dim RSRecord as DAO.Recordset
 

Users who are viewing this thread

Back
Top Bottom