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 » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Textbox dependent on Listbox values



 
 
Thread Tools Display Modes
  #1  
Old October 30th, 2008, 03:34 PM posted to microsoft.public.access.tablesdbdesign
MB
external usenet poster
 
Posts: 211
Default Textbox dependent on Listbox values

Can someone help me write a code that basically says this:

If [MyTxtbox] does not equal any value in [MyLstBox] Then
Msgbox "That value does not exist. Please try another value."

I need to have both the Listbox and the Textbox on my form, but I can't
figure out a code that will check the new value of the textbox if it's been
changed after the first msgbox.
  #2  
Old October 30th, 2008, 03:44 PM posted to microsoft.public.access.tablesdbdesign
mscertified
external usenet poster
 
Posts: 835
Default Textbox dependent on Listbox values

You are approaching this wrong. Never allow a user to enter a value that must
then be checked against a fixed set of values. Always force the user to
select the value from the fixed set in the first place.
A classic exampe of this is what you gave; another example would be a date.
Dates should never be entered but always picked from a calendar.

-Dorian

"mb" wrote:

Can someone help me write a code that basically says this:

If [MyTxtbox] does not equal any value in [MyLstBox] Then
Msgbox "That value does not exist. Please try another value."

I need to have both the Listbox and the Textbox on my form, but I can't
figure out a code that will check the new value of the textbox if it's been
changed after the first msgbox.

  #3  
Old October 30th, 2008, 03:59 PM posted to microsoft.public.access.tablesdbdesign
MB
external usenet poster
 
Posts: 211
Default Textbox dependent on Listbox values

Ok. I've changed the listbox to a combobox to do what you've suggested.
Now, is there a way to do either (or all) of the following:

1. Remove the drop down arrow to force users to type the text instead of
just scrolling through and selecting from the long list?
2. Customize my own error message if the user selects a value that's not in
the list?

Thanks for your help.

"mscertified" wrote:

You are approaching this wrong. Never allow a user to enter a value that must
then be checked against a fixed set of values. Always force the user to
select the value from the fixed set in the first place.
A classic exampe of this is what you gave; another example would be a date.
Dates should never be entered but always picked from a calendar.

-Dorian

"mb" wrote:

Can someone help me write a code that basically says this:

If [MyTxtbox] does not equal any value in [MyLstBox] Then
Msgbox "That value does not exist. Please try another value."

I need to have both the Listbox and the Textbox on my form, but I can't
figure out a code that will check the new value of the textbox if it's been
changed after the first msgbox.

  #4  
Old October 30th, 2008, 03:59 PM posted to microsoft.public.access.tablesdbdesign
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default Textbox dependent on Listbox values

I'm inclined to agree in general with your comment about the OP's specific
question, but I disagree strongly with your "never" and "always" assertions
about populating a date field. In a web page or other situation where there
will be users of all levels and there is considerable risk of a data being
entered incorrectly, I can see your point, but I would not ask a competent
user who can enter the date in a second or two to scroll through a calendar
control (particularly for a date several months or years removed from the
current one) or pick year/month/day from separate drop-down lists.

"mscertified" wrote in message
...
You are approaching this wrong. Never allow a user to enter a value that
must
then be checked against a fixed set of values. Always force the user to
select the value from the fixed set in the first place.
A classic exampe of this is what you gave; another example would be a
date.
Dates should never be entered but always picked from a calendar.

-Dorian

"mb" wrote:

Can someone help me write a code that basically says this:

If [MyTxtbox] does not equal any value in [MyLstBox] Then
Msgbox "That value does not exist. Please try another value."

I need to have both the Listbox and the Textbox on my form, but I can't
figure out a code that will check the new value of the textbox if it's
been
changed after the first msgbox.


  #5  
Old October 30th, 2008, 05:14 PM posted to microsoft.public.access.tablesdbdesign
Beetle
external usenet poster
 
Posts: 1,254
Default Textbox dependent on Listbox values

Maybe you could elaborate a little on what exactly you are trying to
do. On the surface it would seem to make no sense to present the
user with a list of choices, but then not allow them to choose from the
list.

--
_________

Sean Bailey


"mb" wrote:

Ok. I've changed the listbox to a combobox to do what you've suggested.
Now, is there a way to do either (or all) of the following:

1. Remove the drop down arrow to force users to type the text instead of
just scrolling through and selecting from the long list?
2. Customize my own error message if the user selects a value that's not in
the list?

Thanks for your help.

"mscertified" wrote:

You are approaching this wrong. Never allow a user to enter a value that must
then be checked against a fixed set of values. Always force the user to
select the value from the fixed set in the first place.
A classic exampe of this is what you gave; another example would be a date.
Dates should never be entered but always picked from a calendar.

-Dorian

"mb" wrote:

Can someone help me write a code that basically says this:

If [MyTxtbox] does not equal any value in [MyLstBox] Then
Msgbox "That value does not exist. Please try another value."

I need to have both the Listbox and the Textbox on my form, but I can't
figure out a code that will check the new value of the textbox if it's been
changed after the first msgbox.

  #6  
Old October 30th, 2008, 06:05 PM posted to microsoft.public.access.tablesdbdesign
MB
external usenet poster
 
Posts: 211
Default Textbox dependent on Listbox values

Sorry for the confusion. I was able to figure out the custom error message.
What happened next is I resized the box and the arrow was no longer the same
height as the box itself (it's only half as tall), so I was wondering if I
could possibly eliminate the arrow altogether (maybe set it's height to 0").
Then the drop down list would only appear when the user starts typing.

"Beetle" wrote:

Maybe you could elaborate a little on what exactly you are trying to
do. On the surface it would seem to make no sense to present the
user with a list of choices, but then not allow them to choose from the
list.

--
_________

Sean Bailey


"mb" wrote:

Ok. I've changed the listbox to a combobox to do what you've suggested.
Now, is there a way to do either (or all) of the following:

1. Remove the drop down arrow to force users to type the text instead of
just scrolling through and selecting from the long list?
2. Customize my own error message if the user selects a value that's not in
the list?

Thanks for your help.

"mscertified" wrote:

You are approaching this wrong. Never allow a user to enter a value that must
then be checked against a fixed set of values. Always force the user to
select the value from the fixed set in the first place.
A classic exampe of this is what you gave; another example would be a date.
Dates should never be entered but always picked from a calendar.

-Dorian

"mb" wrote:

Can someone help me write a code that basically says this:

If [MyTxtbox] does not equal any value in [MyLstBox] Then
Msgbox "That value does not exist. Please try another value."

I need to have both the Listbox and the Textbox on my form, but I can't
figure out a code that will check the new value of the textbox if it's been
changed after the first msgbox.

 




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 02:29 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.