J
jon
hi
Using a record set I am trying to update a field in a second table and when
the code runs it says it can not find the field 'FreeStateCount' So I have
done something wrong
in the table ComponetNos I have a field called 'Componet No' (I know about
the space not being good)
and on the form I have a control box called 'cmbJob' which is the link to
the 'componeteNos' table with the field 'Componet No'
Can some one please point me in the right direction as to where I am going
wrong.
The code is below
Thanks
Jon
Private Sub ButUpdate_Click()
On Error GoTo Err_ButUpdate_Click
Dim db As DATABASE
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("ComponentNos", dbOpenTable)
With rst
rst.Index = "Componet No"
rst.Seek "=", [CmbJob]
DisplayMessage ([FreeStateCount]) 'line in for debugging
DisplayMessage ("5th if") ' delete after debugging
..Edit
![FreeStateCount] = [FreeStateCount] + 1
..Update
End With
DoCmd.Close
Exit_ButUpdate_Click:
Exit Sub
Err_ButUpdate_Click:
MsgBox Err.Description
Resume Exit_ButUpdate_Click
End Sub
Using a record set I am trying to update a field in a second table and when
the code runs it says it can not find the field 'FreeStateCount' So I have
done something wrong
in the table ComponetNos I have a field called 'Componet No' (I know about
the space not being good)
and on the form I have a control box called 'cmbJob' which is the link to
the 'componeteNos' table with the field 'Componet No'
Can some one please point me in the right direction as to where I am going
wrong.
The code is below
Thanks
Jon
Private Sub ButUpdate_Click()
On Error GoTo Err_ButUpdate_Click
Dim db As DATABASE
Dim rst As Recordset
Set db = CurrentDb()
Set rst = db.OpenRecordset("ComponentNos", dbOpenTable)
With rst
rst.Index = "Componet No"
rst.Seek "=", [CmbJob]
DisplayMessage ([FreeStateCount]) 'line in for debugging
DisplayMessage ("5th if") ' delete after debugging
..Edit
![FreeStateCount] = [FreeStateCount] + 1
..Update
End With
DoCmd.Close
Exit_ButUpdate_Click:
Exit Sub
Err_ButUpdate_Click:
MsgBox Err.Description
Resume Exit_ButUpdate_Click
End Sub