Opening form showing no data in fields

K

KarenB

how do I open a form with all of the fields empty? I have a combo box and the
fields on the form display according to the choice made. That's working
fine, but when I open the form the information from the last record searched
is showing in the fields. How do I reset them so they're blank when the form
opens? FYI, the form is being used to update the data in these records, but
no new records can be added.
 
S

Steve Schapel

Karen,

One way would be to set the Record Source of the form to a query that
returns no records, something like this:
SELECT * FROM YourTable WHERE YourID = 0

This will then probably mean some adjustment to the procedure you currently
use to locate the selected record via the entry in the combobox. It is not
clear what approach you are using for this - adjusting the forms
RecordSource in code, or using the form's Filter property, or using a
FindRecord method, or the Bookmark property of the forms recordset, or some
other approach.
 
I

Ivan Grozney

Karen,

There are a couple of things you can do.

1. Make your form Unbound and then after you select something in the
combo box populate the data from the RecordSet that you create based
on the combo box information. Then when they are done you could
test
if the data has been changed (form IsDirty) and update it as
necessary.

2. Bring up the form with all the controls not visible. In the After
Update
of the combo box, make them all visible (or put them in the detail
section
and in the OnLoad event of the form me.detail.visible=false and in
the
afterupdate of the combo box me.detail.visible=true).

There are lots of folks here way smarter than me that could give you other
options
but these are the ways I do it.

hth

Vanya
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top