P
Pecanfan
I've got a form that I need to Requery after a certain control is changed.
The control (which is an Option Group) simply has this code behind it:-
Private Sub frmJobType_AfterUpdate()
Requery
End Sub
This works fine if I open the form in normal mode (to edit an existing
record) however if I open the form in Add mode (using DoCmd.OpenForm
FRM_Jobs, , , , acFormAdd) the Requery seems to make the form add another
new record, instead of just refreshing the current one.
I don't particularly want to Requery the whole form but I have a DCount
control that refers to an external query and I can't find any other way of
getting the value from the DCount to update properly other than Requery-ing
the whole form. The DCount control contains:-
=DCount("[ItemId]","QRY_MyQuery","[SomethingId] = " & [txtSomethingId])
Alternatively, is there any way I could replace the 'QRY_MyQuery' of the
above DCount statement with:-
SELECT TBL_Table1.ItemId, TBL_Table1.Type, TBL_Table2.SomethingId
FROM TBL_Table1 LEFT JOIN TBL_Table2 ON TBL_Table1.Id = TBL_Table2.Id
WHERE (((TBL_Table1.Type)=2));
Any ideas?
TIA!
Andy
The control (which is an Option Group) simply has this code behind it:-
Private Sub frmJobType_AfterUpdate()
Requery
End Sub
This works fine if I open the form in normal mode (to edit an existing
record) however if I open the form in Add mode (using DoCmd.OpenForm
FRM_Jobs, , , , acFormAdd) the Requery seems to make the form add another
new record, instead of just refreshing the current one.
I don't particularly want to Requery the whole form but I have a DCount
control that refers to an external query and I can't find any other way of
getting the value from the DCount to update properly other than Requery-ing
the whole form. The DCount control contains:-
=DCount("[ItemId]","QRY_MyQuery","[SomethingId] = " & [txtSomethingId])
Alternatively, is there any way I could replace the 'QRY_MyQuery' of the
above DCount statement with:-
SELECT TBL_Table1.ItemId, TBL_Table1.Type, TBL_Table2.SomethingId
FROM TBL_Table1 LEFT JOIN TBL_Table2 ON TBL_Table1.Id = TBL_Table2.Id
WHERE (((TBL_Table1.Type)=2));
Any ideas?
TIA!
Andy