R
rocco
Hello
I have a class code to insert a record into a table by using SQL (a):
CurrentDb.Execute ("INSERT INTO TBLAGENDA (APPOINTMENT,FIRSTVISIT)
VALUES('" & appointment & "'," & m_firstVisit & ")")
status is a variable from one of the class properties. It is settled form
the user and it is boolean.
What is driving me crazy is that if I run the code above it wont work. I
have to change it this way (b):
Dim status As Integer
If m_firstVisit = True Then
status = -1
Else
status = 0
End If
CurrentDb.Execute ("INSERT INTO TBLAGENDA (APPOINTMENT,FIRSTVISIT)
VALUES('" & appointment & "'," & status & ")")
which is fine, not a big deal, but why it shouldn't work?
What I don't understand is that I have tested this:
CurrentDb.Execute ("INSERT INTO TBLAGENDA (APPOINTMENT,FIRSTVISIT)
VALUES('" & appointment & "',TRUE)")
and it works! And i don't see any difference from the code (a) I have wrote.
If I test m_firstVisit value with:
msgbox m_firstVisit
I get True
Thanks,
Rocco
I have a class code to insert a record into a table by using SQL (a):
CurrentDb.Execute ("INSERT INTO TBLAGENDA (APPOINTMENT,FIRSTVISIT)
VALUES('" & appointment & "'," & m_firstVisit & ")")
status is a variable from one of the class properties. It is settled form
the user and it is boolean.
What is driving me crazy is that if I run the code above it wont work. I
have to change it this way (b):
Dim status As Integer
If m_firstVisit = True Then
status = -1
Else
status = 0
End If
CurrentDb.Execute ("INSERT INTO TBLAGENDA (APPOINTMENT,FIRSTVISIT)
VALUES('" & appointment & "'," & status & ")")
which is fine, not a big deal, but why it shouldn't work?
What I don't understand is that I have tested this:
CurrentDb.Execute ("INSERT INTO TBLAGENDA (APPOINTMENT,FIRSTVISIT)
VALUES('" & appointment & "',TRUE)")
and it works! And i don't see any difference from the code (a) I have wrote.
If I test m_firstVisit value with:
msgbox m_firstVisit
I get True
Thanks,
Rocco