Allen Browne's Search Screen clears the first record combo boxes

G

Guest

I am using Allen Browne's Search Screen and can't seem to stop the first
record's entries being blanked out with the reset button. I changed the
original cmdReset_Click() to only set the header fields to Null but my first
record's fields also reset with each control. I am using combo boxes in the
detail section (to display words instead of record id numbers) which isn't
part of the original database. Can someone help?

Greatly appreciated,
Terri
 
A

Allen Browne

Terri, can you confirm whether:
a) the data is being lost, or
b) the data is not being displayed properly.

There is a display problem in Access with combos where the RowSource is
either written programmatically in Form_Current, or is a query that refers
to a control on the form. It's a timing problem, and when you click in the
combo the correct value is displayed. More info:
http://allenbrowne.com/bug-06.html

There is another issue where the combo does not display the desired value
if:
a) its Bound Column is zero-width, and
b) the RowSource excludes the value you need to display.
This setup means Access has nothing to display, even though the bound value
is still in the table correctly.

If neither of these describe your scenario, you need to verify that the data
is being lost from the table. To do this, you need to figure out which row
this is on, and open the table directly. Make sure the table uses a text box
(not a combo) to display the field, and see if the correct data is there or
not. If the data is not there, you must have something that is removing the
data from your controls - some code or macro that is wrongly assigning a
value to these bound controls.
 
G

Guest

Hi Allen,

It was a combination of things, including combo boxes in the tables and
bound controls. I have gone through and corrected everything and it is
working like a charm now. Thank you very much!!

Terri
 
G

Guest

Perhaps you could assist me with adding a "Select All" checkbox to the form.
I can't seem to figure out how to code it. Thank you in advance!
 
A

Allen Browne

So you want to check the box for a field in all records?
Something like this:
Dim strSql As String
strSql = "UPDATE [MyTable] SET [MyYesNo] = True WHERE [MyYesNo] =
False;"
If Me.Dirty Then Me.Dirty = False
dbEngine(0)(0).Execute strSql, dbFailOnError

Replace MyTable and MyYesNo with the name of your table and field.

Best to start a completely new question for a new topic.
 
G

Guest

I apologize. I had forgotten that I had elements from two different forms to
create mine and the record selection check boxes weren't part of your
original Search form.

Allen Browne said:
So you want to check the box for a field in all records?
Something like this:
Dim strSql As String
strSql = "UPDATE [MyTable] SET [MyYesNo] = True WHERE [MyYesNo] =
False;"
If Me.Dirty Then Me.Dirty = False
dbEngine(0)(0).Execute strSql, dbFailOnError

Replace MyTable and MyYesNo with the name of your table and field.

Best to start a completely new question for a new topic.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

Terri said:
Perhaps you could assist me with adding a "Select All" checkbox to the
form.
I can't seem to figure out how to code it. Thank you in advance!
 

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