Hi,
I have a form with STAFF and a subform with SKILLS. When I add a new STAFF record and update its [Job] field, I want to run an append query, to put required skills into a table and immediately update the display of the subform.
I tried two methods:
1. A macro that does "Save" and then "Open append query"
This does the first two parts as the tables are being updated correctly....but how would I then redisplay the subform? I tried Repaint on the subform, but it told me it wasn't open, then I tried Repaint on the main form but it appeared to have no effect.
2. Doing it via code.
I suspect this may me the better way as at least I know how to use the Requery statement (if almost no other code!!)
But what's the syntax for running an append query? The code I came up with (in my hamfisted way) is as follows:
Private Sub Job_AfterUpdate()
DoCmd.Save
DoCmd.OpenQuery(qryAppendRequiredSkills,acViewNormal,,)
Me.frmStaffSkills.Requery
End Sub
But the OpenQuery line is giving me an error message. Compile error. Expected: expression
I don't know what it needs!
I don't mind whether I end up using method one or two, but as you can see I'm stuck on both.
Thanks for any help,
Pat
I have a form with STAFF and a subform with SKILLS. When I add a new STAFF record and update its [Job] field, I want to run an append query, to put required skills into a table and immediately update the display of the subform.
I tried two methods:
1. A macro that does "Save" and then "Open append query"
This does the first two parts as the tables are being updated correctly....but how would I then redisplay the subform? I tried Repaint on the subform, but it told me it wasn't open, then I tried Repaint on the main form but it appeared to have no effect.
2. Doing it via code.
I suspect this may me the better way as at least I know how to use the Requery statement (if almost no other code!!)
But what's the syntax for running an append query? The code I came up with (in my hamfisted way) is as follows:
Private Sub Job_AfterUpdate()
DoCmd.Save
DoCmd.OpenQuery(qryAppendRequiredSkills,acViewNormal,,)
Me.frmStaffSkills.Requery
End Sub
But the OpenQuery line is giving me an error message. Compile error. Expected: expression
I don't know what it needs!
I don't mind whether I end up using method one or two, but as you can see I'm stuck on both.
Thanks for any help,
Pat