J
jeanhurtado
Hi, I have a problem with the select statement. The code is the
following:
************************************************************************************************************
Private Sub cmdOk_Click()
Dim rstTickets As ADODB.Recordset
Dim strSQL As String
Dim nTickets As Integer
nTickets = Val(txtticketqty.Value)
Set conDatabase = CurrentProject.Connection
strSQL = "SELECT * FROM CycleCount WHERE TICKETDATE = " & Null
Set rstTickets = New Recordset
rstTickets.Open strSQL, conDatabase, adOpenDynamic,
adLockOptimistic
With rstTickets
For x = 1 To nTickets
!ticketdate = txtTicketDate
.Update
.MoveNext
Next
End With
rstTickets.Close
conDatabase.Close
Set rstTickets = Nothing
Set conDatabase = Nothing
DoCmd.Close acForm, "CYCLE COUNT TICKETS", acSaveYes
End Sub
**********************************************************************************************************************
The meaning of this code is to insert the date that are contain in a
textbox into the ticketdate null fields in a table(Cycle Count) but
when I run the code it tell me the following error:
Run-Time error '-2147217900 (80040e14)':
Syntax error (missing operator) in query expression 'TICKETDATE='.
I have review the error but all is good I also have examples that
shows me that in the select statement when can use the = operator and
then use " then & and value. Can you help me Thnaks so much for your
anticipated help.
following:
************************************************************************************************************
Private Sub cmdOk_Click()
Dim rstTickets As ADODB.Recordset
Dim strSQL As String
Dim nTickets As Integer
nTickets = Val(txtticketqty.Value)
Set conDatabase = CurrentProject.Connection
strSQL = "SELECT * FROM CycleCount WHERE TICKETDATE = " & Null
Set rstTickets = New Recordset
rstTickets.Open strSQL, conDatabase, adOpenDynamic,
adLockOptimistic
With rstTickets
For x = 1 To nTickets
!ticketdate = txtTicketDate
.Update
.MoveNext
Next
End With
rstTickets.Close
conDatabase.Close
Set rstTickets = Nothing
Set conDatabase = Nothing
DoCmd.Close acForm, "CYCLE COUNT TICKETS", acSaveYes
End Sub
**********************************************************************************************************************
The meaning of this code is to insert the date that are contain in a
textbox into the ticketdate null fields in a table(Cycle Count) but
when I run the code it tell me the following error:
Run-Time error '-2147217900 (80040e14)':
Syntax error (missing operator) in query expression 'TICKETDATE='.
I have review the error but all is good I also have examples that
shows me that in the select statement when can use the = operator and
then use " then & and value. Can you help me Thnaks so much for your
anticipated help.