Question about editing data

  • Thread starter Thread starter David Brown
  • Start date Start date
D

David Brown

I have a form where users record information about customer visits. The data
entry begins with a combo box that lists the various store locations. The
user sees the name of the store but it is actually the unique site key that
gets recorded in the customer visit table. All of that is fine but the users
also want the ability to edit past visits. I use a command button with the
following code to do that:

Private Sub cmdEditVisits_Click()

Me.Refresh
Me.DataEntry = False
Me.NavigationButtons = True
Me.FilterOn = False
Me.AllowAdditions = False

End Sub

The text boxes display the data for each entry just like they should.
However, that first combo box stays blank and never shows the store location
for each record. Even if I hid the combo box and displayed a text box, it
would probably show the site key and not the name. How can I display the
name of the store?

Thanks,

David Brown
 
What is the ControlSource of the combo box? and what is its RowSource?
Where on the form is the combo box located?
Is the form a continuous forms view, or a single form view?
 
The default view is single form.

The combo box rowsource is a Table/Query: SELECT qry_ActiveSites.Site_key,
qry_ActiveSites.Site_Name FROM qry_ActiveSites.

There is an AfterUpdate procedure that populates a hidden text box with
visit_SiteID as its control source. The combo box itself does not have a
control source. That is why it stays blank when I go into "edit" mode. I had
actually forgotton about that.

I could always hide the combo box and show the text box when the user wants
to view/edit visits. I don't want the user to be able to change the
location, just view the name of the location instead of the number.

Thanks,

David
 
You could set the Value of the combo box to the value that is in the
visit_SiteID textbox. That would let the combo box display the appropriate
location -- because the combo box is unbound (it has no Control Source), the
user would not be able to change the location value in the actual record.

You could do this in the form's Current event, perhaps. That event will
occur whenever the user moves from one record to another.
 
Thanks Ken, that worked great.

David


Ken Snell (MVP) said:
You could set the Value of the combo box to the value that is in the
visit_SiteID textbox. That would let the combo box display the appropriate
location -- because the combo box is unbound (it has no Control Source),
the user would not be able to change the location value in the actual
record.

You could do this in the form's Current event, perhaps. That event will
occur whenever the user moves from one record to another.
 

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

Back
Top