M
Martin
Hello,
I am trying to update a specific record from soem unbound fields in a form.
Here is the code from the button to update the record:
Private Sub Update_Click()
Dim dbs As Database, rs As Recordset
Set dbs = CurrentDb
Set rs = dbs.OpenRecordset("QryStaffHours", dbOpenSnapshot)
rs.Edit
rs![Jan '08 (a/l)] = Me![Jan4].Value
rs![Feb '08 (a/l)] = Me![Feb4].Value
rs![Mar '08 (a/l)] = Me![Mar4].Value
rs![Apr '08 (a/l)] = Me![Apr4].Value
rs![May '08 (a/l)] = Me![May4].Value
rs![Jun '08 (a/l)] = Me![Jun4].Value
rs![Jul '08 (a/l)] = Me![Jul4].Value
rs![Aug '08 (a/l)] = Me![Aug4].Value
rs![Sep '08 (a/l)] = Me![Sep4].Value
rs![Oct '08 (a/l)] = Me![Oct4].Value
rs![Nov '08 (a/l)] = Me![Nov4].Value
rs![Dec '08 (a/l)] = Me![Dec4].Value
rs.Update
End Sub
The qyuery called "QryStaffHours" works perfectly and is updatable. I am
fairly new to VBA so am trying to peice this together from what i know but I
think I am having trouble with the dbOpen part. Can anyone help please?
Thank you.
Martin
I am trying to update a specific record from soem unbound fields in a form.
Here is the code from the button to update the record:
Private Sub Update_Click()
Dim dbs As Database, rs As Recordset
Set dbs = CurrentDb
Set rs = dbs.OpenRecordset("QryStaffHours", dbOpenSnapshot)
rs.Edit
rs![Jan '08 (a/l)] = Me![Jan4].Value
rs![Feb '08 (a/l)] = Me![Feb4].Value
rs![Mar '08 (a/l)] = Me![Mar4].Value
rs![Apr '08 (a/l)] = Me![Apr4].Value
rs![May '08 (a/l)] = Me![May4].Value
rs![Jun '08 (a/l)] = Me![Jun4].Value
rs![Jul '08 (a/l)] = Me![Jul4].Value
rs![Aug '08 (a/l)] = Me![Aug4].Value
rs![Sep '08 (a/l)] = Me![Sep4].Value
rs![Oct '08 (a/l)] = Me![Oct4].Value
rs![Nov '08 (a/l)] = Me![Nov4].Value
rs![Dec '08 (a/l)] = Me![Dec4].Value
rs.Update
End Sub
The qyuery called "QryStaffHours" works perfectly and is updatable. I am
fairly new to VBA so am trying to peice this together from what i know but I
think I am having trouble with the dbOpen part. Can anyone help please?
Thank you.
Martin