G
Guest
Hi! i have a problem when i am running this code. i don't knw what is wrong
with this. i am looping through a table and on each row. when i am on that
row. i want to go to another table with the tempLevel and get the tempSalary.
what happen is i get a invalied argument error. and it point ing to "Set
rstQ = db.OpenRecordset(strSQL, dbOpenSnapshot)". i don't know why this
error. what i want is: while i am looping through main table get a tempLevel
value which is a primary key for table CS22. i want to go there and get the
value. help me with this.Thanks!
Dim strSQL As String
dim tempLevel as String
Dim tempSalary As Currency
Dim rstQ As Recordset
Set db = CurrentDb()
tempLevel = value ' a value will be diffrent in each row when we loop
strSQL = "SELECT [A] FROM [CS22] WHERE [(Level =
tempLevel)];"
Set rstQ = db.OpenRecordset(strSQL, dbOpenSnapshot)
tempSalary = rstQ![A]
MsgBox (strSQL)
with this. i am looping through a table and on each row. when i am on that
row. i want to go to another table with the tempLevel and get the tempSalary.
what happen is i get a invalied argument error. and it point ing to "Set
rstQ = db.OpenRecordset(strSQL, dbOpenSnapshot)". i don't know why this
error. what i want is: while i am looping through main table get a tempLevel
value which is a primary key for table CS22. i want to go there and get the
value. help me with this.Thanks!
Dim strSQL As String
dim tempLevel as String
Dim tempSalary As Currency
Dim rstQ As Recordset
Set db = CurrentDb()
tempLevel = value ' a value will be diffrent in each row when we loop
strSQL = "SELECT [A] FROM [CS22] WHERE [(Level =
tempLevel)];"
Set rstQ = db.OpenRecordset(strSQL, dbOpenSnapshot)
tempSalary = rstQ![A]
MsgBox (strSQL)