G
Guest
I see this question comes up all the time, but I still haven't got it right.
Users want to update a Yes/No field (VolLet) on table "TREG" a record at a
time by clicking a command button on a continuous form (FVolLet) which is
based on a non updateable querry(Group by with sums and count totals).
This is the first time a am trying to write "Update" code.
The following code gives me a type mismatch error.
VolLet is Yes/No format
RecordNo is a text field.
Can someone determine the error (s), or maybe suggest that I am going about
this the wrong way and point me in a more appropriate direction.
Private Sub CmdUpdate_Click()
On Error GoTo Err_CmdUpdate_Click
Dim db As Database
Dim rst As Recordset
Dim RecordNo As String
Dim VolLet As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("TREG")
rst.Seek "=", Forms!FVolLet!RecordNo
VolLet = -1
rst.Update
rst.Close
Exit_CmdUpdate_Click:
Exit Sub
Err_CmdUpdate_Click:
MsgBox Err.Description
Resume Exit_CmdUpdate_Click
End Sub
Thank you
Users want to update a Yes/No field (VolLet) on table "TREG" a record at a
time by clicking a command button on a continuous form (FVolLet) which is
based on a non updateable querry(Group by with sums and count totals).
This is the first time a am trying to write "Update" code.
The following code gives me a type mismatch error.
VolLet is Yes/No format
RecordNo is a text field.
Can someone determine the error (s), or maybe suggest that I am going about
this the wrong way and point me in a more appropriate direction.
Private Sub CmdUpdate_Click()
On Error GoTo Err_CmdUpdate_Click
Dim db As Database
Dim rst As Recordset
Dim RecordNo As String
Dim VolLet As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("TREG")
rst.Seek "=", Forms!FVolLet!RecordNo
VolLet = -1
rst.Update
rst.Close
Exit_CmdUpdate_Click:
Exit Sub
Err_CmdUpdate_Click:
MsgBox Err.Description
Resume Exit_CmdUpdate_Click
End Sub
Thank you