G
Guest
I just could not figure out what is wrong or missing - here my sample code:
Dim horse_recordset As New ADODB.Recordset
Dim SQLstmt As String
Dim xyz As Integer
xyz = 13
SQLstmt = "SELECT [Horse-ID], [Horse Name], [Registration Nummer],
[Breed] FROM Horses WHERE (Horses.[Horse-ID] = xyz);"
horse_recordset.Open SQLstmt, CurrentProject.Connection,
adOpenForwardOnly, adLockReadOnly
Regardless of what I have tried I always get the same error - if I enter a
specific value in the query for ex. I "hard-code" 13 into the query instead
of xyz the query runs with no error - therefore it must have something to do
the way I use or declare the variable xyz or the syntax.
PLEASE HELP!!!!
Dim horse_recordset As New ADODB.Recordset
Dim SQLstmt As String
Dim xyz As Integer
xyz = 13
SQLstmt = "SELECT [Horse-ID], [Horse Name], [Registration Nummer],
[Breed] FROM Horses WHERE (Horses.[Horse-ID] = xyz);"
horse_recordset.Open SQLstmt, CurrentProject.Connection,
adOpenForwardOnly, adLockReadOnly
Regardless of what I have tried I always get the same error - if I enter a
specific value in the query for ex. I "hard-code" 13 into the query instead
of xyz the query runs with no error - therefore it must have something to do
the way I use or declare the variable xyz or the syntax.
PLEASE HELP!!!!