How to load blank form before combo box selection (1 Viewer)

RyLane

Registered User.
Local time
Today, 09:39
Joined
Feb 4, 2014
Messages
60
Hi,

I have a form that I populate after making selections in two combo boxes but when I load the form the text boxes are already filled in with the first record. The combo boxes load blank, which is what I want.

How do I get the rest of the form to be blank on load? It is made up of text boxes and check boxes that are all bound. Will this only work if they are unbound?

Thanks
 

pr2-eugin

Super Moderator
Local time
Today, 14:39
Joined
Nov 30, 2011
Messages
8,494
Yes, it should be an unbound Form if you want them to be empty on open.

Normally you will open a Form to do filtering (unbound), then from there open the Actual bound form. The bound form can have an unbound filter control too. But this is the way I would go with. Maybe you can look into this as an alternative?
 

RyLane

Registered User.
Local time
Today, 09:39
Joined
Feb 4, 2014
Messages
60
Thanks, I was afraid of that. I'm learning on the go here and keep discovering things that I should of done earlier.

I'm a little confused though. If I make a subform with all the bound text boxes and check boxes, it will be clear on load until I make a selection on the main form combo box?
 

pr2-eugin

Super Moderator
Local time
Today, 14:39
Joined
Nov 30, 2011
Messages
8,494
Then set up a Recordsource of the Subform in such a way no records would be displayed, then after changing the ComboBox selection change the recordsource of the SubForm again?
 

Mile-O

Back once again...
Local time
Today, 14:39
Joined
Dec 10, 2002
Messages
11,316
Surely it depends if you are wanting to store the values of the combos in a table or not, before you open the form again.

Don't know how you're opening the form, whether by double clicking it, via a macro, VBA, or from another form. But you would just go to a new record.

For example, using a Macro. You would select the OpenForm option and also the Date Mode of 'Add'. When you open the form via the Macro, it would go to a new record on the recordsource (table or query; preferably the latter) bound to your form.
 

RyLane

Registered User.
Local time
Today, 09:39
Joined
Feb 4, 2014
Messages
60
Pr2 - Sounds good in theory but I can't say I know how to do that. I put a subform in with all the bound text boxes and left the unbound combo boxes on the main form. Not sure what to set the record source to so that it does what you're saying.

Mile - I open by double clicking. I don't want to store anything. And when do I run this macro?
 

Mile-O

Back once again...
Local time
Today, 14:39
Joined
Dec 10, 2002
Messages
11,316
Mile - I open by double clicking. I don't want to store anything. And when do I run this macro?
If you're not storing anything, go with the unbound option. But macro could be in your form's OnLoad event.
 

RyLane

Registered User.
Local time
Today, 09:39
Joined
Feb 4, 2014
Messages
60
Thats what I don't undertand right now. How do I make all these text boxes unbound if they are bound right now? Is that something that I can do?

I know I can set the row source for a subform to something but how is this going to be linked to my combo box selection on the main form?
 

ozsupra

Registered User.
Local time
Today, 23:39
Joined
Apr 16, 2014
Messages
16
There are multiple ways to skin a cat.
I had the same problem and used a trick to fool the users.
I set the font colour to that of the background so that the user thinks the record is blank. I then change the colour on the update.
 

Simon_MT

Registered User.
Local time
Today, 14:39
Joined
Feb 26, 2007
Messages
2,177
I put an unbound form before the Form with actual data and apply fuzzy logic it there are multiple combi-boxes.

The advatage is that ehen you go to the data form you will have applied a filter that is re-useable.

Simon
 

Attachments

  • Schemes_Dialogue.png
    Schemes_Dialogue.png
    37.6 KB · Views: 207

missinglinq

AWF VIP
Local time
Today, 09:39
Joined
Jun 20, 2003
Messages
6,423
The standard way of doing this is to simply open the Form on a New Record.

Code:
Private Sub Form_Load()
  DoCmd.GoToRecord , , acNewRec
End Sub
Linq ;0)>
 

Simon_MT

Registered User.
Local time
Today, 14:39
Joined
Feb 26, 2007
Messages
2,177
The advantage of filtering is that if the record exists then you end up with a populated record if it doesn't you end up on a New Record - check first then add.

Using filtering means that you don't need create a separate script and goto New Record and this Dialogue can be used for general enquiries as well as reports.

You should always filter data anyway particularly with large recordsets - I'm using 303,0
000 records and Access is not a particularly happy bunny if I thrash the database.

Simon
 

Users who are viewing this thread

Top Bottom