Opening/Closing Subforms

jax

Registered User.
Local time
Today, 08:30
Joined
Mar 4, 2002
Messages
61
I am fairly new to Access and struggling a little. I have a main form which has a command button which opens a subform. I want the subform to open with blank fields so that new information can be entered. I also have a command button which closes the subform, I would like this to also refresh the data on the mainform automatically. At present the list is only updated if I close the main form and reopen it. Please someone help!!
 
In the onClick property of the command button type
docmd.refresh
I think that'll work

Colin
 
Thanks for the reply. I tried to enter the docmd.refresh in the command button OnClick, but i cant get it too work. Thanks for any help.
 
When you see the Click event listing under Properties for your command button, click the [...] button at the end of the line. Go into code builder and put 'DoCmd.Refresh' on the open line, so it will look something like this:
Private Sub cmdOpenSubform_Click
DoCmd.Refresh
End Sub

When you close the VBA (Code) window, you'll see [Event Procedure] in the Click event blank. Now try it and see if it works.

HTH,
David R



[This message has been edited by David R (edited 03-05-2002).]
 
Sorry, that may have been overkill. I see you have your command button already, but does it use Macros to do the things you ask? You can a) find the macro code analogous to DoCmd.Refresh, or b) convert your macros over to VBA and insert the line I mentioned.

No time to start learning like the present, but do what works for you...hopefully you'll find VBA faster, more flexible, and not too scary.

David R
 

Users who are viewing this thread

Back
Top Bottom