Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 443
  • Last Modified:

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

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
busbeead
Asked:
busbeead
  • 3
  • 3
  • 2
1 Solution
 
nico5038Commented:
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
 
shanesuebsahakarnCommented:
Can you not link your second subform directly to your textbox (or list/combo box if that's what it is)?
0
 
busbeeadAuthor Commented:
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
busbeeadAuthor Commented:
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
 
shanesuebsahakarnCommented:
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
 
nico5038Commented:
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
 
busbeeadAuthor Commented:
It looks like setting the textbox =Form!MyListBox worked perfectly.

Thanks for all the help!
0
 
nico5038Commented:
Hmm, no subForm1 selection ?

Nic;o)
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 3
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now