What is wrong in this code ?

rs.Open " update TblName set FldNum=" & text1.Text & " where ID_FldName=" & Text2.Text , db, adOpenDynamic, adLockOptimistic

Knowing that
FldNum ---> Data type (Number)
ID_FldName ---> Data Type (AutoNumber)

And What the correct code ?

Recommended Answers

All 3 Replies

Looks like you have it... Only need to add single ticks around strings and since both of your fields are numeric, I think you have it...

Good Luck

Try using

rs.Open "update TblName set FldNum = '" & Text1.Text & "' where ID_FldName = '" & Text2.Text & "'", db, adOpenDynamic, adLockOptimistic

Hope this helps

Kin, please reread this thread...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.