editing listview using change button
can anybody tell me why i got syntax error(missing operator) in query expression'ID='; here is the code what i have written.any help would be greatly appreciated.
Code:
Private Sub Command2_Click()
If CheckInput = True Then
Dim success As Boolean
Set con = New ADODB.Connection
success = OpenConnection(con)
If success = False Then
MsgBox ("Cannot Open Connection")
Exit Sub
End If
Set rs = New ADODB.Recordset
rs.Open "select * from supplierS where ID=" & Text1.Text, con, adOpenDynamic, adLockOptimistic
If rs.BOF And rs.EOF Then rs.AddNew
' rs.Fields("Supplier_id") = Text1.Text
rs.Fields("Supplier_name") = Text2.Text
rs.Fields("contact_person") = Text3.Text
rs.Fields("contact_no") = Text4.Text
rs.Fields("office_address") = Text6.Text
rs.Fields("emails") = Text7.Text
rs.Fields("website") = Text8.Text
rs.Fields("Fax_no") = Text5.Text
rs.Fields("item_type") = Combo1.Text
rs.Update
MsgBox ("data saved")
rs.Close
Else
Exit Sub
End If
con.Close
Set con = Nothing
End Sub
Re: editing listview using change button
Do the same thing we keep saying in all the other threads. If you paste that into Access, it will tell you the error. (I suspect ID is a reserved word, that you have to change)
Otherwise, what's in the textbox? If it's a number, then things should work
Re: editing listview using change button
Is this the exact same error again ????
Could it be that the Supplier_ID is an AUTO_ALLOCATED field which means you cannot allocate a number to it (ever) ???
It is Auto Allocated by the database when you first add a record
Only you know the answer as we cannot see your table definitions
The last few requests for help you have posted are about this exact problem. (You never tell us if this answer solves your problem, but you stop asking when given this answer)
It will go a long way to help everyone help you, if you put RESOLVED along side your posts where relevant
Please FIROZ - if what I am telling you is correct, follow these instructions
1) Put a link to this thread on your desktop
2) Next time you get a syntax error which has any field name with _ID associated with it, click the link
Re: editing listview using change button
Re: editing listview using change button
Quote:
Originally Posted by
firoz.raj
Resolved
Go to the FIRST POST, pull down THREAD TOOLS, and mark it as RESOLVED.
This will change the HEADER so we don't have to scroll to the bottom to see that it's RESOLVED
1 Attachment(s)
Re: editing listview using change button