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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variables Input to Table

Status
Not open for further replies.

JimCowan

Technical User
Jul 12, 2000
10
CA
Using Access/VBA 2000,
I want to push the value of a variable (varPayGrade)into a table (Salary_History), field (HPayGrade).
I have an open recordset, looks like this...

varPayGrade=10
Set rst = New ADODB.Recordset
rst.Open "Salary_History", CurrentProject.Connection
rst.Edit
Salary_History("HPayGrade") = varPayGrade
rst.Update
rst.Close
Set rst = Nothing

Not only can I not succeed to input, .Edit and .Update are also giving error messages. Thanks, anyone who can help me.
 
Hi,

Try

Code:
[COLOR=red]
Set rst = New ADODB.Recordset
    rst.Open "Salary_History", CurrentProject.Connection,,adlockoptimistic
    rst.fields("HPayGrade") = varPayGrade
    rst.Update
    rst.Close
Set rst = Nothing
[\color]
[\code]

Ciao
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top