• Access 2007 CurrentDb.Execute problem

    Author
    Topic
    #473238

    I have a table called tblAllocate.
    One of the fields is a lookup field called Job# which has numbers in it eg 55548 and the field in the table it looks to is definitely a number field.
    I am trying to do the following in a button code on a form:

    CurrentDb.Execute “DELETE * FROM tblAllocate WHERE Job# = ” & [Job#]

    but I get the error

    Run-time error ‘3075’:

    Syntax error in date in query expression ‘Job# = 55548’

    but I don’t have any dates in the table or expression?????

    Help?

    Viewing 1 reply thread
    Author
    Replies
    • #1256479

      The use of # in the field name is causing the problem. # is used to precede dates in SQL.

      It is best to avoid all special characters in field names. Can you rename the field to JOBID?

    • #1256492

      Thanks John,

      Done and done! Problem solved.

    Viewing 1 reply thread
    Reply To: Access 2007 CurrentDb.Execute problem

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: