F
FSt1
greetings all
using access xp.
i am trying to build a form that tracks gas milage. i
have the form, it works. i am using a DOA recordset to
update the table from the form but the update is giving a
error on the set rsstemn.
if i add "dbopendynaset" or "dbOpenTable" as type, i get
runtime error 13 type mismatch
If i leave the type field blank, i get the same error.
Thanks in advance to anyone who can help.
Code as follows:
Private Sub CmdAccept_Click()
Dim Dbstenm As Database
Dim rsstenm As Recordset
Set Dbstenm = CodeDb()
'error on line below.
Set rsstenm = Dbstenm.OpenRecordset("stenmilage",
dbOpenTable)
With rsstenm
.AddNew
!Date = txtDate
!EndMiles = txtEndMiles
!StartMiles = txtStartmiles
!MilesDriven = txtMilesdriven
!CumMiles = txtCumMiles
!GalsUsed = txtGalUsed
!CumGals = txtCumGals
!DolsPerGal = txtDolsPerGal
!Dols = txtDolsPerTank
!CumDols = txtCumDols
!Days = txtDaysPerTank
!MPGTank = txtMPGTank
!CumMPG = txtCumMPG
!DolsPerMile = txtDolsPerMile
!DolsPerDay = txtDolsPerDay
!MilesPerDay = txtMilesPerDay
!Comments = txtComments
.Update
End With
rss10m.Close
Dbs10m.Close
MsgBox (" Record was added.")
Me.Requery
Call Clear_Form
End Sub
using access xp.
i am trying to build a form that tracks gas milage. i
have the form, it works. i am using a DOA recordset to
update the table from the form but the update is giving a
error on the set rsstemn.
if i add "dbopendynaset" or "dbOpenTable" as type, i get
runtime error 13 type mismatch
If i leave the type field blank, i get the same error.
Thanks in advance to anyone who can help.
Code as follows:
Private Sub CmdAccept_Click()
Dim Dbstenm As Database
Dim rsstenm As Recordset
Set Dbstenm = CodeDb()
'error on line below.
Set rsstenm = Dbstenm.OpenRecordset("stenmilage",
dbOpenTable)
With rsstenm
.AddNew
!Date = txtDate
!EndMiles = txtEndMiles
!StartMiles = txtStartmiles
!MilesDriven = txtMilesdriven
!CumMiles = txtCumMiles
!GalsUsed = txtGalUsed
!CumGals = txtCumGals
!DolsPerGal = txtDolsPerGal
!Dols = txtDolsPerTank
!CumDols = txtCumDols
!Days = txtDaysPerTank
!MPGTank = txtMPGTank
!CumMPG = txtCumMPG
!DolsPerMile = txtDolsPerMile
!DolsPerDay = txtDolsPerDay
!MilesPerDay = txtMilesPerDay
!Comments = txtComments
.Update
End With
rss10m.Close
Dbs10m.Close
MsgBox (" Record was added.")
Me.Requery
Call Clear_Form
End Sub