Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SQL problem 1

Status
Not open for further replies.

ITbeast

IS-IT--Management
Jul 25, 2006
67
US
i'm trying to do an update statement in VB. what is the correct syntax for this. i keep getting syntax errors. I'm trying to update a table with a variable named intLine_num where the formid in the table matches the variable txtFormId


DoCmd.RunSQL "Update cb_Numbers SET line_num = " & intLine_num & "WHERE ((txtFormID) = "cbNumbers.formid")
 
There were some missing spaces and other syntax errors. Assuming Line_Num is numeric and FormID is text:
Code:
Dim strSQL as String
strSQL ="Update cb_Numbers SET line_num = " & intLine_num & _
   " WHERE formid =""" & txtFormID & """"
DoCmd.RunSQL strSQL

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Maybe this is a larger problem that just a syntax error. Can I really do what I'm trying to do here.

I'm trying to record what line number a particular record showed up on. I then need to run a seperate report that says which line. So I'm trying to store that line number with that UPDATE statement.
 
dhookom, you are the man.... or woman.... either way, thanks for the help
 
I would hope to be "the man" as that is what my wife, children, and grandchild expect.

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top