A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Show code meaning rather than code value



 
 
Thread Tools Display Modes
  #1  
Old February 6th, 2010, 12:45 AM posted to microsoft.public.access.forms
oldblindpew
external usenet poster
 
Posts: 128
Default Show code meaning rather than code value

I have a text box in a form that is displaying (as it should) the value of a
code that is stored in the bound field (hope I'm saying this right). I want
to display the code's meaning rather than its value.

I know a combo box would do it, and I'll use one if I have to, but I only
want to display the meaning, whereas a combo box is for picking a value.

Thanks,
OldBlindPew
  #2  
Old February 6th, 2010, 01:15 AM posted to microsoft.public.access.forms
Jeff Boyce
external usenet poster
 
Posts: 8,621
Default Show code meaning rather than code value

Not sure how you're using the term "meaning"...

Are you saying you have a table somewhere that has a couple of fields, a
code and a "meaning" (is that the same as a title, or description or ...)?
And that you want to see that second part instead of the code?

Then yes, a combobox can do that quite easily.

First build a query that returns both code and "...". Then base your
combobox on that query.

In the design view, highlight the combobox, and set 2 columns, and set the
width of the first column (i.e., the code) to 0 (zero).

Now when you use the combobox, the code is what the combobox is storing in
the underlying field, but the "..." is what it is displaying in the form.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"oldblindpew" wrote in message
...
I have a text box in a form that is displaying (as it should) the value of
a
code that is stored in the bound field (hope I'm saying this right). I
want
to display the code's meaning rather than its value.

I know a combo box would do it, and I'll use one if I have to, but I only
want to display the meaning, whereas a combo box is for picking a value.

Thanks,
OldBlindPew



  #3  
Old February 6th, 2010, 03:08 AM posted to microsoft.public.access.forms
AccessVandal via AccessMonster.com
external usenet poster
 
Posts: 461
Default Show code meaning rather than code value

Or maybe you're asking about the Balloon Help?

oldblindpew wrote:
I have a text box in a form that is displaying (as it should) the value of a
code that is stored in the bound field (hope I'm saying this right). I want
to display the code's meaning rather than its value.

I know a combo box would do it, and I'll use one if I have to, but I only
want to display the meaning, whereas a combo box is for picking a value.

Thanks,
OldBlindPew


--
Please Rate the posting if helps you.

Message posted via http://www.accessmonster.com

  #4  
Old February 6th, 2010, 07:37 AM posted to microsoft.public.access.forms
John W. Vinson
external usenet poster
 
Posts: 18,261
Default Show code meaning rather than code value

On Fri, 5 Feb 2010 15:45:01 -0800, oldblindpew
wrote:

I have a text box in a form that is displaying (as it should) the value of a
code that is stored in the bound field (hope I'm saying this right). I want
to display the code's meaning rather than its value.

I know a combo box would do it, and I'll use one if I have to, but I only
want to display the meaning, whereas a combo box is for picking a value.


It *can be used* for picking a value, but it doesn't force you to do so. In
fact if you set its Enabled property to No, Locked to Yes, it will display the
text value even though it's bound to the numeric value, but it will not let
the user affect either.
--

John W. Vinson [MVP]
  #5  
Old February 8th, 2010, 08:06 PM posted to microsoft.public.access.forms
oldblindpew
external usenet poster
 
Posts: 128
Default Show code meaning rather than code value

What I'm wishing for is that the down arrow portion of the Combo Box would
disappear when the control is locked. It's just an aesthetic matter of not
wanting to show the user a non-functional control, and I think this would be
reasonable for the control to operate this way. Barring this, I would like
to use a Text Box, except I want to display the code's meaning from the
lookup table, rather than the code itself which is stored in the child table.
I suppose to do this I would have to join the lookup table to the child
table in my query, so my form would have access to that field?

I did not understand your suggestion about the Enabled and Locked
properties. A Combo Box will display the first column from the RowSource
that has a non-zero width, regardless of what you do with the Enabled and
Locked properties.

Thanks,
Pew

"John W. Vinson" wrote:

On Fri, 5 Feb 2010 15:45:01 -0800, oldblindpew
wrote:

I have a text box in a form that is displaying (as it should) the value of a
code that is stored in the bound field (hope I'm saying this right). I want
to display the code's meaning rather than its value.

I know a combo box would do it, and I'll use one if I have to, but I only
want to display the meaning, whereas a combo box is for picking a value.


It *can be used* for picking a value, but it doesn't force you to do so. In
fact if you set its Enabled property to No, Locked to Yes, it will display the
text value even though it's bound to the numeric value, but it will not let
the user affect either.
--

John W. Vinson [MVP]
.

  #6  
Old February 9th, 2010, 12:14 AM posted to microsoft.public.access.forms
oldblindpew
external usenet poster
 
Posts: 128
Default Show code meaning rather than code value

Jeff, thanks for replying.

I have a lookup table with two fields: Code and Meaning. Sample values
would be "A" and "Active", respectively.

My child table has a field for the Code as a foreign key, but I want my
form's textbox to show Meaning rather than Code, e.g. "Active" rather than
"A". As stated previously, I know a Combo Box will do this, and I know how
to make it work, so this was not my question. My question is how to do it
with a Text Box.

My reason for wanting a Text Box is aesthetic. In my form, this control
will be display-only. I don't see any point in presenting a non-functional
Combo Box to the user. In fact, I think a locked Combo Box should change
appearance to look like a locked Text Box. If it's locked (read-only) why
should there even be a down arrow/selector button followed by a drop-down
pick list, which the user is not going to be able to use anyway?

Thanks,
Pew

"Jeff Boyce" wrote:

Not sure how you're using the term "meaning"...

Are you saying you have a table somewhere that has a couple of fields, a
code and a "meaning" (is that the same as a title, or description or ...)?
And that you want to see that second part instead of the code?

Then yes, a combobox can do that quite easily.

First build a query that returns both code and "...". Then base your
combobox on that query.

In the design view, highlight the combobox, and set 2 columns, and set the
width of the first column (i.e., the code) to 0 (zero).

Now when you use the combobox, the code is what the combobox is storing in
the underlying field, but the "..." is what it is displaying in the form.

Good luck!

Regards

Jeff Boyce
Microsoft Access MVP

--
Disclaimer: This author may have received products and services mentioned
in this post. Mention and/or description of a product or service herein
does not constitute endorsement thereof.

Any code or pseudocode included in this post is offered "as is", with no
guarantee as to suitability.

You can thank the FTC of the USA for making this disclaimer
possible/necessary.

"oldblindpew" wrote in message
...
I have a text box in a form that is displaying (as it should) the value of
a
code that is stored in the bound field (hope I'm saying this right). I
want
to display the code's meaning rather than its value.

I know a combo box would do it, and I'll use one if I have to, but I only
want to display the meaning, whereas a combo box is for picking a value.

Thanks,
OldBlindPew



.

  #7  
Old February 9th, 2010, 03:49 AM posted to microsoft.public.access.forms
Ron[_23_]
external usenet poster
 
Posts: 27
Default Show code meaning rather than code value

I have a lookup table with two fields: Code and Meaning. Sample values
would be "A" and "Active", respectively.

My child table has a field for the Code as a foreign key, but I want my
form's textbox to show Meaning rather than Code, e.g. "Active" rather than
"A". As stated previously, I know a Combo Box will do this, and I know
how
to make it work, so this was not my question. My question is how to do it
with a Text Box.


Assuming the record source for the child table is MyQuery and that Code
field is FK, how about this:

Select Meaning from MyLookupTable where MyQuery.FK = MyLookupTable.Code

Store the query as MyQuery2 and use DLookup("Meaning","MyQuery2") as control
source for the text box.

Warning: Noob suggestion, based on advice given me in another thread for
analogous (but more complicated) situation. -Ron

  #8  
Old February 9th, 2010, 09:35 PM posted to microsoft.public.access.forms
oldblindpew
external usenet poster
 
Posts: 128
Default Show code meaning rather than code value

Thanks, Ron. The answer probably lies along these lines. For a Combo Box,
one can just name the lookup table as the Row Source. A Text Box doesn't
have its own Row Source, but has to use the form's Record Source. (I
probably don't understand all this right, but this is how it looks to me at
this time).

I also mentioned locking the controls, but this isn't right either. When I
lock the control, no data can be enterered at all. I don't want to
completely prevent data entry, but I just don't want the user to accidentally
change anything.

Thanks again,
Pew

"Ron" wrote:

I have a lookup table with two fields: Code and Meaning. Sample values
would be "A" and "Active", respectively.

My child table has a field for the Code as a foreign key, but I want my
form's textbox to show Meaning rather than Code, e.g. "Active" rather than
"A". As stated previously, I know a Combo Box will do this, and I know
how
to make it work, so this was not my question. My question is how to do it
with a Text Box.


Assuming the record source for the child table is MyQuery and that Code
field is FK, how about this:

Select Meaning from MyLookupTable where MyQuery.FK = MyLookupTable.Code

Store the query as MyQuery2 and use DLookup("Meaning","MyQuery2") as control
source for the text box.

Warning: Noob suggestion, based on advice given me in another thread for
analogous (but more complicated) situation. -Ron

.

  #9  
Old February 10th, 2010, 03:23 AM posted to microsoft.public.access.forms
AccessVandal via AccessMonster.com
external usenet poster
 
Posts: 461
Default Show code meaning rather than code value

oldblindpew wrote:
I also mentioned locking the controls, but this isn't right either. When I
lock the control, no data can be enterered at all. I don't want to
completely prevent data entry, but I just don't want the user to accidentally
change anything.


You can use the Textbox beforeupdate event to cancel the input. Like

Private Sub Text1_BeforeUpdate(Cancel as Interger)
If Me.Text1.OldValue Me.Text1 Then
msgbox "You can't change the value"
me.text1.undo
Cancel = True
Else
' do nothing
End If
End Sub

You might also want to deal with the Form's Dirty property.

--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

  #10  
Old February 10th, 2010, 05:11 PM posted to microsoft.public.access.forms
oldblindpew
external usenet poster
 
Posts: 128
Default Show code meaning rather than code value

Thanks for reading and replying. I fear I've offended the gods as some of my
recent questions have met with silence.

When a new record is added via my form, some of the fields are populated
from other tables, and this is the data I wish to protect. The key question
is whether the Before Update event will interfere with the addition of the
new record and automatic population of certain of its fields. Should be easy
enough to try and see. I have not yet needed the different events other than
On Click.

In the past I've created a separate form for updating vs. adding. I'm
thinking one cannot simultaneously allow and disallow editing in the same
form. Perhaps this is why a traditional approach uses modes: Add, Delete,
Update, and Browse. Obviously I have more to learn.

Thanks Again,
Pew

"AccessVandal via AccessMonster.com" wrote:

oldblindpew wrote:
I also mentioned locking the controls, but this isn't right either. When I
lock the control, no data can be enterered at all. I don't want to
completely prevent data entry, but I just don't want the user to accidentally
change anything.


You can use the Textbox beforeupdate event to cancel the input. Like

Private Sub Text1_BeforeUpdate(Cancel as Interger)
If Me.Text1.OldValue Me.Text1 Then
msgbox "You can't change the value"
me.text1.undo
Cancel = True
Else
' do nothing
End If
End Sub

You might also want to deal with the Form's Dirty property.

--
Please Rate the posting if helps you.

Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...forms/201002/1

.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:42 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.