Access 2003 VBA SQL Insert Limitation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CJVBAAccess
    New Member
    • Mar 2008
    • 2

    Access 2003 VBA SQL Insert Limitation

    I have a Query that I need to insert 58 columns of data. I built the query in VBA, but it will not work. Says it is missing a comma (,) so when i display what the Final Query looks like it is missing paramaters at the end. Is there a limitation on the size that a Query can be? Can there only be so many characters, including the column names, in a query?

    How can I get around this?
    Do I have to insert the data for half the form, and then get the last row inserted (which I do not know how to do) and then update the newly inserted row with the rest of the data from the form?

    Thanks
    CJ
  • Stewart Ross
    Recognized Expert Moderator Specialist
    • Feb 2008
    • 2545

    #2
    Originally posted by CJVBAAccess
    I have a Query that I need to insert 58 columns of data. I built the query in VBA, but it will not work. Says it is missing a comma (,) so when i display what the Final Query looks like it is missing paramaters at the end. Is there a limitation on the size that a Query can be? Can there only be so many characters, including the column names, in a query?

    How can I get around this?
    Do I have to insert the data for half the form, and then get the last row inserted (which I do not know how to do) and then update the newly inserted row with the rest of the data from the form?

    Thanks
    CJ
    Hi. As a piece of general advice, if you have written some code and you get an error it is not Access that is the most likely cause - it is the code you've just written. I am absolutely certain there is an error in your code, and if you would like to post it in a reply the contributors to this forum will be able to advise you further on what should be changed to resolve your error.

    -Stewart

    Comment

    • CJVBAAccess
      New Member
      • Mar 2008
      • 2

      #3
      Originally posted by Stewart Ross Inverness
      Hi. As a piece of general advice, if you have written some code and you get an error it is not Access that is the most likely cause - it is the code you've just written. I am absolutely certain there is an error in your code, and if you would like to post it in a reply the contributors to this forum will be able to advise you further on what should be changed to resolve your error.

      -Stewart
      To clarify, I did not write the code, I am fixing someone elses mess.

      It is an access problem, there was no error in the code, Access (VBA) will only allow you to have so many characters in an insert Statement.

      It is working now. I did an insert statement that inserted the primary information. Then I check to see what ID number of the row I just inserted is, pull it back and do an update statement to get the rest of the information into the database table for that record.

      Thanks for your reply, it is working great now.

      Comment

      Working...