Hi all,
I'm trying to get a field value through a DAO.Recordset but keep getting and error message when i load the form.
the error is : Invalid use of New keyword
..and the code stops where i've highlighted in red.
Anyone help?
Cheers,
Spinkung
I'm trying to get a field value through a DAO.Recordset but keep getting and error message when i load the form.
the error is : Invalid use of New keyword
..and the code stops where i've highlighted in red.
Code:
Dim str1 As String
[COLOR="Red"]Dim rs As New DAO.Recordset[/COLOR]Dim db As Database
Set db = CurrentDb
lby = Mid(Me.refNo.Value, 4, 3)
str1 = "SELECT dbo_tbl_RetRANRequest_USERS.userName " & _
"FROM dbo_tbl_RetRANRequest_USERS " & _
"WHERE dbo_tbl_RetRANRequest_USERS.userID = " & lby & ""
Set rs = db.OpenRecordset(str1, dbOpenDynaset, dbSeeChanges)
Me.logBy.Value = db.Fields("userName").Value
Anyone help?
Cheers,
Spinkung