sticky records

  • Thread starter Thread starter Bill H.
  • Start date Start date
B

Bill H.

I have a combo box on a form. Selecting from the combo box shows certain
fields from the underlying table on the form. These formfields have their
property set to enabled and locked.

I have another combo box which sets the rowsource for the combo box
described above, using a WHERE clause to limit the choices displayed in the
above combo box based on certain factors. Problem is that when this combo
box writes sql to the rowsource of the other box, and that query results in
no records, the above combo box is blank, but the fields still display data
from the prior record. Under that situation, I want the displayed fields to
be blank, but I can't do that because I'm not on any valid record. Yet, if
I use the access record, refresh, it DELETES the current record from the
table! I don't expect to use that refresh menu item, but a user might and
there goes some data.
 
OK. First, it sounds like you are using this form only to look up data, not
to create new records (since the controls are enabled but locked, thus
preventing changes). While this will not prevent deletion of a record, a
record will not be deleted unless something in your code is deleting it. You
should be able to use Me.Refresh in your code to force the other controls to
display the correct values.

Here are three questions:

1. Are the controls (other than the two combo boxes you use to select
records) bound to fields in the table, or are you manually populating them in
VBA?

2. Exactly which menu option are you using to "refresh"?

3. What code do you run in the AfterUpdate of your selection combo box? That
is, how does the choice in that box bring up the record for the user, thus
populating the other controls?
 
Back
Top