Combox Box for LOOK UP....but LOCK the Records ???

  • Thread starter kev100 via AccessMonster.com
  • Start date
K

kev100 via AccessMonster.com

I feel silly even asking this.....but....I've tried multiple options and
things seem to be all or nothing.

I've got a Simple table....just 2 fields:

Name and Phone

I'm needing a form with 1 combo box tied to the Name field and 1 Text box
paired with the Phone field.

I'm just needing the users to be able to scroll through and click on the
needed name (listed in alphabetically) and have the phone number appear in
the text box next to it.

I've got that working fine...EXCEPT that the fields are Editable.

.....But if I change all the options in the properites of those 2 boxes to
disallowing edits/adds, etc.....then they can't even SELECT a name. They can
click the arrow and scroll through them...but they can't select one.

This has to be something obvious.....but it's the first time I've ever needed
to create of these little lookup forms and it's oddly puzzling.

Any advice appreciated....

Thanks
 
G

Guest

Instead of setting the form's properties, set the textbox Locked property to
Yes. This will prevent changes but will allow the user to copy the contents
to the clipboard.
 
K

kev100 via AccessMonster.com

Bill said:
Instead of setting the form's properties, set the textbox Locked property to
Yes. This will prevent changes but will allow the user to copy the contents
to the clipboard.

That worked great on the Text box (which displays the phone number).

But....they can edit the Name field (the one displayed by the pull-down
scroller combo box).

If I lock it to prevent editing.....they can no longer select anything...they
can scroll down and view the list...but not select an item.

Should I be using a different type of control for this "find and display
only" function?

Thanks
 
R

Rick Brandt

kev100 said:
That worked great on the Text box (which displays the phone number).

But....they can edit the Name field (the one displayed by the
pull-down scroller combo box).

If I lock it to prevent editing.....they can no longer select
anything...they can scroll down and view the list...but not select an
item.

Should I be using a different type of control for this "find and
display only" function?

Thanks

A ComboBox is for "looking up" (navigating) OR for editing data. You can't
use one to do both. You lock the controls used for editing and don't lock
the one used for navigating. Just remove the ControlSource for the
ComboBox. Then it will ONLY navigate and have no effect on the data.
 
K

kev100 via AccessMonster.com

A ComboBox is for "looking up" (navigating) OR for editing data. You can't
use one to do both.
You lock the controls used for editing and don't lock
the one used for navigating. Just remove the ControlSource for the
ComboBox. Then it will ONLY navigate and have no effect on the data.

Thanks very much.......the edit on the Text box did it.

I spoke to soon about the combo being editable. It WILL let you type
something in....but it does not actually edit the value. When it is viewed
again, those "edits" are not there.


----------------------------

There is an something that would be nice to change...if possible.....

The TEXT box which displays the Phone Number shows the # in the very first
record when the form is initially opened. Nothing is showing in the combo
box until it is selected.

Is it possible to set it so that it is empty as well....when initally opened?
It's not a huge deal, but would be less (potentially) confusing for the user.

Thanks
 
G

Guest

Kev

To do what you want, just make the form unbound (remove the recordsource if
it has one) and remove the control source from the text box. Use the combo's
AfterUpdate event to set the text box's value.

Example:

Private Sub Combo11_AfterUpdate()
Me.txtMyTextBox = DLookup("Phone", "Customers", _
"CompanyName=" & Chr(34) & Me.Combo11 & Chr(34))

End Sub
 

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