editing a record in a table

J

jon

Hi
In a form I am editing a record in a table called [baan] but at the end I
want to adjust a record in another table [ComponentNos] and I am unsure how
to do it.
The form has a field called "CmbJob" which I need to refer to in the other
table [Componet No] is the name of this field and then add 1 to 2 fields or
reset them to 0 if the job has failed.

so the sum I want to run is

[ComponentNos]![FreeStateCount] = [ComponentNos]![FreeStateCount] + 1
[ComponentNos]![FreeStatePassCount] = [ComponentNos]![FreeStatePassCount] +
1
but how do I select the right record?

the table is called [ComponentNos] and the link field is [Componet No]

hope this makes sense.

Thanks

Jon
 
J

jon

Hi
I am having a go but I have got stuck again
the cide I have so far is :-

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]) ' test line
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

But when I get to the test line it says it can't find the field.

the field [FreeStateCount] is in the recordset/ table and the [CmbJob] is a
feild on a form
Any advise on what I have done worng is welcome

Thanks

Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top