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  dBforums > PC based Database Applications > Microsoft Access > Display value from query in form field

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Posts: 34
Display value from query in form field

Hey group,
This should be an easy answer because all that has me stumped is the syntax. I'm trying to get a value in a select query (which only pulls up one record) to display in a field on a form. The form is based on another query, so I can't just set the form to the query. Also, I'm not trying to update any tables. I'm just temporarily displaying the information. I did search for the answer but never could find info on this particular subject.
I'm assuming you can add something to the property box for the field under Control Source. Here's the basic setup

qryRecord
[Area]

Want to display [Area] in frmUser in the field named Area.

Thanks in advance for any help.

David
Reply With Quote
  #2 (permalink)  
Old
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,102
I don't know what qryRecord or [Area] is, but I'm willing to bet you can join whatever table [Area] comes from to your pre-existing query in the form's recordsource.
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #3 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Posts: 34
Sorry, I was trying to be easy. qryRecord is just the name of my query. [Area] is one of the values in the query that I want to show up in the form in a field that is also named Area.
Reply With Quote
  #4 (permalink)  
Old
Purveyor of Discontent
 
Join Date: Mar 2003
Location: The Bottom of The Barrel
Posts: 6,102
how is Area related to the current record you're viewing? You have something to key in on right?
__________________
oh yeah... documentation... I have heard of that.

*** What Do You Want In The MS Access Forum? ***
Reply With Quote
  #5 (permalink)  
Old
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 11,663
when do you want to trigger the update

you could do a dlookup, or an SQL select and assign that as part of the trigger process.

Lets assume you are looking up the area (based on telephone area code?

write a function which retrieves the area value
eg GetAreaValue(AreaCode as ????) as string


you then need to force that area code to update every time the value that contains the area changes. this will happen when you move records within a recordset, or you change the trigger value. for the former the forms "on current" event is handy, the latter the controls on chanage, on lost focus events are usefull.

if that is you problem area have a look at the help system and try to understand what events are.

If that isn't your problem then you need to consider how you define what the problem is, and how you describe that problem on this forum - by defintion we don't know your application and are not going to understand the problem in the same ligth as you see it.

Often sitting down to clearly think through the problem automatically brings a solution to mind, some of that is experience, but some is just breaking the problem into logical steps and then attempting to find a technical solution to the problem at hand.
HTH
__________________
I'd rather be riding my Versys or my Tiger 800 let alone the Norton
Reply With Quote
  #6 (permalink)  
Old
Registered User
 
Join Date: Jul 2004
Posts: 34
Sorry guys

I'm gussing I really confused everyone. I apologize for that.

I did figure out the answer to what I needed. all it took was this code in the Control Source Box of the field:

=DLookUp("[Area]","qryUserInfo")

This will pull up the area information stored in another table when a form is opened that normally reads data from a different table. Thanks to all those that tried to help. Hopefully this post will be useful to someone else.

David
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On