Text Box with ability to enter the user friendly 'looked up' value

G

Green Biro

I want a user to enter marks for a register "/" = Present, "A" = Auth Absent
and "U" = Unauth Absence on a form

If I use a combo, I can display - and allow the user to enter - the friendly
codes.

Can I somehow allow them to enter the user friendly values into a textbox
such that it would update the table. When I change my control to a textbox,
it's only possible to enter the key (0,1 or 2) that the table is expecting.

Thans in advance for any insights

GB
 
A

Arvin Meyer [MVP]

Remember the table is going to display data that's entered, you can use the
AfterUpdate event to change the entry, but you cannot put text in a numeric
field. A combo or list box is the proper control for entering and displaying
data which is from a different field than what is being stored.
 
G

Green Biro

I felt that it was quite important for the user to be able to enter the
'friendly' into a simple text box rather than a listbox.

I accomplished this by having two fields in the table I was querying, one
with the key value and one with the friendly value. Although I have the key
value field in a textbox in my form, it is hidden from the user. I use the
DLookup function in the "After_Update" event of the friendly name field to
write the correct value into the key value field. I also use the Dlookup
function in the validation property of the friendly field textbox to ensure
that a valid entry has been made.

All seems to be working so far....

GB
 
A

Arvin Meyer [MVP]

You could make it faster and use fewer resources by using a function with a
Select Case statement to write the choice to the second field in the
AfterUpdate event. Also rather than using 2 fields to store a single value
of data, you might use the Current function of the form to fill an unbound
textbox. This will only work for single form view though.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 

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