Results 1 to 5 of 5

Thread: SQL Problem!!!

  1. #1
    Join Date
    May 2004
    Posts
    20

    Question Unanswered: SQL Problem!!!

    i'm having a problem with an access database that i'm trying to use SQL statements in. what i'm trying to do is update a table from information that is put onto a form but i can't bind the form to the table. the information needs to be put in the table so that another form can pull it up when needed. i tried using sql statements to pull this off, this is what i have:

    strSQL = "Update KanbanCards SET NumberofCards =" & NumCards & " WHERE Item# =" & [Forms]![KanbanCards]![Item#] & ""

    DoCmd.RunSQL strSQL

    however when i run my program and click on the command button that will eventually run this code, i get 2 input boxes asking for values and i just click okay through those and then i get an error saying "Syntax error in date in query expression 'Item# = 8912004'" where the item number is just a part number that i'm working with. i don't have a clue what the problem is. if anyone has a good idea on what to try or to do it would be greatly appreciated. thank you very much in advance.

  2. #2
    Join Date
    Apr 2004
    Location
    Kansas City, MO
    Posts
    734
    I don't suppose your Item# is a text field is it?
    MeanOldDBA
    derrickleggett@hotmail.com
    When life gives you a lemon, fire the DBA.

  3. #3
    Join Date
    Jan 2004
    Location
    The Netherlands
    Posts
    421
    Which is why you shouldnt use !@#$%^&*()_ and "spaces" in field names !!!!


    *Sigh* will we ever learn???

    strSQL = "Update KanbanCards SET NumberofCards =" & NumCards & " WHERE [Item#] =" & [Forms]![KanbanCards]![Item#] & ""

    Regards

  4. #4
    Join Date
    May 2004
    Posts
    20
    yes it is a text field actually, will that make a difference? i didn't write the original database so don't yell at me!!! i wondered if the fact that item# does have the # sign in it will cause the error but i read that # is a valid character to use to name variables.

  5. #5
    Join Date
    May 2004
    Posts
    20
    i did what you have right there and now i'm getting a data mismatch but my table has number for the data type of NumberofCards and i'm entering a 2 as the value.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •