Save and Refresh (in separate subforms)

  • Thread starter Thread starter Chris
  • Start date Start date
C

Chris

I have in a form 2 subforms:
- in the first I am entering the data (materials with quantities and
qualities)
- in the second subform you can see the data entries (introduced using the
first subform) and some other calculated fields (the results are from a
query).

Actually, after entering the data in the first subform i use a cmd. button
for saving the record, and after that, in the second subform , with another
cmd. button I refresh the data displayed (using a macro with the Requery and
ShowAllRecords actions ), after every record enterd from the first subform.

Is any posibillity to do these things with a single command button?
How?
 
---------- "Chris said:
I have in a form 2 subforms:
- in the first I am entering the data (materials with quantities and
qualities)
- in the second subform you can see the data entries (introduced using the
first subform) and some other calculated fields (the results are from a
query).

Actually, after entering the data in the first subform i use a cmd. button
for saving the record, and after that, in the second subform , with another
cmd. button I refresh the data displayed (using a macro with the Requery and
ShowAllRecords actions ), after every record enterd from the first subform.

Is any posibillity to do these things with a single command button?
How?

Chris,

put this in the first command button's OnClick event right after the
save command:

Me![NameOfSecondSubformControl].Form.Requery

Also I'd consider making a single subform for everything, but for this
I know too few from the purpose.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
I tried and I get the error message: Microsoft Access can't find the field
'NameOfSecondSubformControl' in your expression.
Here is the code used by me:

Private Sub Save_Click()
On Error GoTo Err_Salvare_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me![Intr2-e].Form.Requery
Exit_Save_Click:
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Salvare_Click

End Sub

Emilia Maxim said:
---------- "Chris said:
I have in a form 2 subforms:
- in the first I am entering the data (materials with quantities and
qualities)
- in the second subform you can see the data entries (introduced using the
first subform) and some other calculated fields (the results are from a
query).

Actually, after entering the data in the first subform i use a cmd. button
for saving the record, and after that, in the second subform , with another
cmd. button I refresh the data displayed (using a macro with the Requery and
ShowAllRecords actions ), after every record enterd from the first subform.

Is any posibillity to do these things with a single command button?
How?

Chris,

put this in the first command button's OnClick event right after the
save command:

Me![NameOfSecondSubformControl].Form.Requery

Also I'd consider making a single subform for everything, but for this
I know too few from the purpose.

Best regards
Emilia

Emilia Maxim
PC-SoftwareService, Stuttgart
http://www.maxim-software-service.de
 
I tried and I get the error message: Microsoft Access can't find the field
'NameOfSecondSubformControl' in your expression.

It sounds like you have some OTHER code with Emilia's generic
"NameOfSecondSubformControl" in it. Obviously her intent was that you
replace this with the actual name of that control - might you have
copied the expression to some other bit of code?

Try opening the VBA editor and searching for the fieldname that it's
complaining about.
 
Back
Top