Jacob Hilderbrand
06-12-2006, 03:26 PM
Quick question here. Refering to this code:
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim rs As Object
Dim Rep As String
Set rs = CurrentDb.OpenRecordset("TblVariables")
Do While Not rs.EOF
If rs(1) = "CurrentSalesRep" Then
Rep = rs(2)
Exit Do
End If
rs.MoveNext
Loop
SalesRep = Rep
Set rs = Nothing
End Sub
I would think that rs should be a RecordSet data type, but when I try to Dim it as RecordSet or New RecordSet the code errors out. Object works fine, but I would like to use the proper datatype.
Thanks
Private Sub Form_BeforeInsert(Cancel As Integer)
Dim rs As Object
Dim Rep As String
Set rs = CurrentDb.OpenRecordset("TblVariables")
Do While Not rs.EOF
If rs(1) = "CurrentSalesRep" Then
Rep = rs(2)
Exit Do
End If
rs.MoveNext
Loop
SalesRep = Rep
Set rs = Nothing
End Sub
I would think that rs should be a RecordSet data type, but when I try to Dim it as RecordSet or New RecordSet the code errors out. Object works fine, but I would like to use the proper datatype.
Thanks