Clearing a subform of data on open

molsen

Registered User.
Local time
Today, 15:16
Joined
Sep 13, 2012
Messages
50
Hi All

I have a Form with an unbound combo box which, when selecting a date in the drop down, the underlying continuous subform populates with data. I have added a switchboard control which opens the form (in edit) and, even though I have managed to get the main control to be clear on entry, the underlying subform is populated with data from the data entered in the first date.

I need it to be open in edit, as I want the user to be able to select the data and view data, as well as being able to enter/edit the displayed data.

Any idea how I get the form to open in edit, with all fields in the subform empty, until the user selects a date from the main form control?
 
Depends on how you are updating the subform

1. If you are using the linkchild and master fields on the subform control then in the mainform onopen event set the value of your date field to null

2. If you are updating the subform filter in the afterupdate event of your date control then on the subform on load event set the subform filter=""

3. Alternatively if you are updating the subform by rewriting the subform recordsource, in the subform on load event, set the subform recordsource=""
 
two ways at least

1. set the subform's recordsource to "" initially, and just set it to the real value when required.

2. base the subform on a query that uses the comobo box, in such a way that initially no details are extracted.

note that having no records may affect the way you see controls on the form, so you may need to try different things to get the best effect.
 
Thank you both.

Only being a UI user, not much VB or SQL, I think its option 1 that CJ listed. The control is an unbound combo drop down, and is blank when I first load the form.

The subform has the linkchild and linkmaster info.

When I open properties for the main form, and choose On Open, can you tell me what I have to put between the following?

Private Sub Form_Open(Cancel As Integer)

End Sub
 

Users who are viewing this thread

Back
Top Bottom