record changed values

G

Guest

I'm trying to record a change onto a table.

In a previous message "subject = Chosen Few Only" Tony T is assisting me in
allowing a certain user to change a value.

This question is to record the value being changed:
In the code below I removed all the values to record except one, just to get
something recored in the table. I cannot understand why I am getting the
error: Runtime error 3075, Syntex error (missing operator) in query
expression 'tblTrackingData.ICNNOFROM tbleTrackingData WHERE
(((tblTrackingData.ICNNO)="000000195097"))'.

It's even showing me the value to record "000000195097"....

Dim lCriteria As String
Dim lICCNNO As String

lICCNNO = Me!ICNNO

If MsgBox("Are you sure you want to change the dates? ", vbQuestion &
vbYesNo, "Question") = vbYes Then
DoCmd.SetWarnings False

Dim lID As Long
lID = GetNewID("t_DateChanged")
lCriteria = "INSERT INTO t_DateChanged ( ID, ICNNO) "

lCriteria = lCriteria & "SELECT " & lID & " AS tID,
tblTrackingData.ICNNO"
lCriteria = lCriteria & "FROM tblTrackingData "
lCriteria = lCriteria & "WHERE (((tblTrackingData.ICNNO)=" &
"""" & lICCNNO & """" & "));"
DoCmd.RunSQL lCriteria


Suggestions????
 
S

strive4peace

Hi Dan,

you need to seperate with spaces... put a space before FROM and WHERE...

lCriteria = lCriteria & " FROM tblTrackingData "
lCriteria = lCriteria & " WHERE ..."

as a rule of thumb, I generally start each line with a space after the
quote -- just to make sure thee is one! more than one is ok, but none
is not ;)

In your case, the problem is that there is not a space before FROM and
after ICNNO

Warm Regards,
Crystal
*
:) have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

New ID 1
Capture Date deleted 5
Send data to table 11
Transfer data 14
Save Deleted Record 16
Write to table then read data 1
OpenRecordSet Error 3
Dialog in MsgBox 4

Top