?
Solved

OnClick of Query Results in unbound Textbox update a separate hidden text box.

Posted on 2005-03-05
8
Medium Priority
?
433 Views
Last Modified: 2012-06-21
I have an unbound text box that is filled with the results of a query.  The fields in the textbox are
ItemID and ItemType

I would like to be able to click on any of the results and have it update a hidden text box on the same form so that I can use that result to filter a second subform.  The later part of the quetstion has been answered here:

http://www.experts-exchange.com/Databases/MS_Access/Q_21326607.html

The first part seems like it would be simple, but it is tough for me.  When I click on an item in the textbox results of a query I would like the ItemID to be updated into the hidden textbox.  something like:

Onclick_Textbox
me.textbox.Itemid = me.hiddentextbox

Is this possible??
0
Comment
Question by:busbeead
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
  • 2
8 Comments
 
LVL 54

Expert Comment

by:nico5038
ID: 13466767
I would expect that you fill the "hidden" like:
me.hiddentextbox =me.textbox.Itemid

But looks to me that you mean a listbox instead of a textbox, am I right ?

Nic;o)
0
 
LVL 41

Expert Comment

by:shanesuebsahakarn
ID: 13466781
Can you not link your second subform directly to your textbox (or list/combo box if that's what it is)?
0
 

Author Comment

by:busbeead
ID: 13466798
Nico5038,
  Yes, it is a listbox.  I need to re-read my questions a bit better before sending them.  I will try what you suggested to see if it will do.

Thanks
0
Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

 

Author Comment

by:busbeead
ID: 13466823
shanesuebsahakarn,
   How would I link the two?  I tried to use the listbox as the record source for the subform, but that obviously did not work.  I guess if I link them and set the subform to single form then it will just change as I click on the records in the listbox?

Thanks.
0
 
LVL 41

Accepted Solution

by:
shanesuebsahakarn earned 2000 total points
ID: 13466833
I meant to link the second subform to the listbox.

Alternatively, you could set the hidden textbox's control source to:
=Form!MyListBox

That will automatically update the textbox whenever the listbox is changed (assuming that the listbox is bound to the Itemid column of its query).
0
 
LVL 54

Expert Comment

by:nico5038
ID: 13466859
Hmm, when you still have the setup like in the previous question:

MainForm
Subform1
Field1   Field2

Subform2
Details of ItemClicked in subform1

And added the hidden field, then linking to the listbox won't work as it's colliding with the Subform1 that's setting a value to the hidden textfield. Wanting this would imply that the subform should be selecting a row from the listbox, but I guess the hiddenfield approach is as good and will be easier on the user's eye as the listbox will stay "stable" when selecting a field in subform1.
Perhaps unselecting an optionally chosen value from the listbox when using subform1 might even be advisable.

Nic;o)
0
 

Author Comment

by:busbeead
ID: 13466919
It looks like setting the textbox =Form!MyListBox worked perfectly.

Thanks for all the help!
0
 
LVL 54

Expert Comment

by:nico5038
ID: 13466945
Hmm, no subForm1 selection ?

Nic;o)
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
This article describes a method of delivering Word templates for use in merging Access data to Word documents, that requires no computer knowledge on the part of the recipient -- the templates are saved in table fields, and are extracted and install…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question