Results 1 to 6 of 6
  1. #1
    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

  2. #2
    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? ***

  3. #3
    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.

  4. #4
    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? ***

  5. #5
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    12,569
    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 on the Tiger 800 or the Norton

  6. #6
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •