blank form on open

S

Sonja

Hi,

Wondering if there is anyone kind and clever enough to help with this
seemingly simple equation, please ?

I have a form, based on a table. It has 10 fields. When the form is
opened, it displays the first record of the table, but I want it to open and
be blank.

Any ideas are greatly appreciated.

Thanks,

Sonja.
 
M

missinglinq via AccessMonster.com

In Design View goto the form's Property Box > Data > Set Data Entry to YES
When the form opens it will be on a new record with all fields blank.
 
S

Sonja

Thank you - I tried that, and yes, the form opened with all records blank,
BUT, the form's purpose is to display only, not to add or edit data. When I
changed the form's properties Data Entry to YES, the form didn't display any
data when I chose a value in my combo box.

So, basically, I want the form to Open on Blank. Then the user chooses a
value from a combo box and that filters through and displays the fields
according to that chosen value. I've got the whole combo box thing working,
it's just on open, the first record of the table displays but I don't want it
to - is that possible ?

Thanks so much for your time !

Sonja.
 
J

John Vinson

So, basically, I want the form to Open on Blank. Then the user chooses a
value from a combo box and that filters through and displays the fields
according to that chosen value. I've got the whole combo box thing working,
it's just on open, the first record of the table displays but I don't want it
to - is that possible ?

Put one line in the Form's Load event:

Private Sub Form_Load()
DoCmd.GoToRecord acForm, Me.Name, acNewRecord
End Sub

This will move to the blank (except for fields with Default Values
defined) "new" record, and the user could start entering data into it.

If you want "a blank form" with no existing record NOR the new record
selected, it will be a great deal more work (probably changing the
Control Source of each control).

John W. Vinson[MVP]
 
S

SteveS

In the Open event (OnOpen) you could set a filter that would return zero
records.

You would have to use a field where the condition would never match. If the
recordsource included a primary key from a table; if the PK field is of type
autonumber and named [MyTableID], the filter might be

DoCmd.ApplyFilter , "MyTableID = NULL"


If you have a field [LastName] that is required, you could set the filter to

DoCmd.ApplyFilter , "LastName = 'ABC123'"


Then when a value in the combo box is selected, the filter is changed, and
records (if any) will be displayed.


HTH
 
B

BruceM

A brute force but fairly simple approach would be to place a box over the
form except for the search combo box. Set the box's color to match the form
background color, and set its Back Style to Solid. In the search combo box
After Update event you could set the box's Visible property to False (or set
its BackStyle to Transparent, or otherwise format it as you choose). This
would show you a blank space rather than a collection of blank controls, but
maybe it will meet your needs.
If you want to see a blank form maybe you could lock all of the controls (be
setting their Locked property to Yes), then open to a new record as John
suggested, but I don't know how well that would work. FWIW, users will tend
to ignore everything except the search combo box until they have selected a
record.
 
J

John Vinson

In the Open event (OnOpen) you could set a filter that would return zero
records.

I like that much better than my suggestion, Steve!

John W. Vinson[MVP]
 
Top