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 » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Desperate for help



 
 
Thread Tools Display Modes
  #1  
Old February 16th, 2007, 03:10 PM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 3
Default Desperate for help

Here is what I am trying to do: I have two controls on a
"subform" (a combobox and a textbox). I have the row source of the
combo set to the value of a query which gives me two choices. After I
select one of the choices I would like the afterupdate event to fill
in the text box with the remaining choice. I have tried creating a
parameter query that uses the value from the combo box in an criteria
so that the query selects any value that the value of the combo.
When I simply run the query it gives me the value I want. However
when
I try to set the value of the text box to the query in the after
update event of the combo box, nothing appears. Both controls are
bound to different fields on
the same table which are part of a one to many relationship between
the main form and subform. I would appreciate
anyone that could shed some light on this for me... Thanks

  #2  
Old February 16th, 2007, 05:10 PM posted to microsoft.public.access.queries
Dale Fye
external usenet poster
 
Posts: 2,651
Default Desperate for help

It would seem to me that you could use dlookup to get the value from the
query you use to populate your first combo box.

1. Assume your cbo uses query1 to return an ID (bound, but hidden) and some
other text value

2. Then in the after update of that combo, you need to put something like:

Private sub cbo_afterUpdate

Dim strCriteria as string

strCriteria = "ID " & me.cbo.value
me.yourTextbox = DLOOKUP("FieldName", "query1", strCriteria)

End sub

HTH
Dale
--
Email address is not valid.
Please reply to newsgroup only.


" wrote:

Here is what I am trying to do: I have two controls on a
"subform" (a combobox and a textbox). I have the row source of the
combo set to the value of a query which gives me two choices. After I
select one of the choices I would like the afterupdate event to fill
in the text box with the remaining choice. I have tried creating a
parameter query that uses the value from the combo box in an criteria
so that the query selects any value that the value of the combo.
When I simply run the query it gives me the value I want. However
when
I try to set the value of the text box to the query in the after
update event of the combo box, nothing appears. Both controls are
bound to different fields on
the same table which are part of a one to many relationship between
the main form and subform. I would appreciate
anyone that could shed some light on this for me... Thanks


 




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:58 PM.


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