G
Guest
Hi everyone,
I am trying to create a record set using VB within Access (code below). I
get an error at the first Execute Line. I'm sure I will get an error with
the second one also, but I haven't been able to pass the first error.
Private Sub Command41_Click()
'extract month and year from Fleet_DD and put into a table
strsql = "Select * from ERIP_SERNOtbl order by Dash_16_SERNO"
Set rsFleetDate = Execute (strsql)
rsFleetDate.MoveFirst
While Not rsFleetDate.EOF
strFleetDate = rsFleetDate!Fleet_DD
YR = DatePart("yyyy", strFleetDate)
Mo = DatePart("mm", strFleetDate)
intID = rsFleetDate!Dash_16_SERNO
strsql = "Insert into TempFleet values(" & intID & ", '" & YR & "', '" & Mo
& "')"
Execute (strsql)
rsFleetDate.MoveNext
Wend
End Sub
I tried to hard code the database, to put db infront of execute to use
db.execute. The problem is it doesn't recognize the word Database in "Dim db
as Database"
Does anyone see what I'm doing wrong, or what I need to do instead?
Thanks in Advance!
I am trying to create a record set using VB within Access (code below). I
get an error at the first Execute Line. I'm sure I will get an error with
the second one also, but I haven't been able to pass the first error.
Private Sub Command41_Click()
'extract month and year from Fleet_DD and put into a table
strsql = "Select * from ERIP_SERNOtbl order by Dash_16_SERNO"
Set rsFleetDate = Execute (strsql)
rsFleetDate.MoveFirst
While Not rsFleetDate.EOF
strFleetDate = rsFleetDate!Fleet_DD
YR = DatePart("yyyy", strFleetDate)
Mo = DatePart("mm", strFleetDate)
intID = rsFleetDate!Dash_16_SERNO
strsql = "Insert into TempFleet values(" & intID & ", '" & YR & "', '" & Mo
& "')"
Execute (strsql)
rsFleetDate.MoveNext
Wend
End Sub
I tried to hard code the database, to put db infront of execute to use
db.execute. The problem is it doesn't recognize the word Database in "Dim db
as Database"
Does anyone see what I'm doing wrong, or what I need to do instead?
Thanks in Advance!