INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.
Jobs from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Moving DLookup results on form to a text box bound to a table
2

Share

Moving DLookup results on form to a text box bound to a table

Moving DLookup results on form to a text box bound to a table

(OP)
I have found many answers to this problem, but cannot get any to work.  I hope someone can offer some help.  I have a form with a text field that performs a DLookup from a query(txt1).  That part works great.  

However, I need to have the data bound back to the table that the form is bound to.  So, the answer appears to be; creating an additional text box (txt2).  Then, go back to txt1, go to AfterUpdate and entering me.txt2 = me.txt1.

I have tried doing this with no success. Nothing appears in Txt2 (therefore nothing populates the table it is bound to).  Please help me figure this out - what am I missing?

RE: Moving DLookup results on form to a text box bound to a table

It is generally consider bad practice to store a value that can be calculated on the fly. If you really have a good reason, based on your naming, txt2 should have a control source of a field from the record source of the form.

It txt1 contains a DLookup() expression, it will never trigger an "AfterUpdate" event. You must have some other control or controls that should fire the AfterUpdate to push the calculated value int txt2.

You might need to tell us more about your calculation, DLookup(), control sources, etc.

Duane
Hook'D on Access
MS Access MVP

RE: Moving DLookup results on form to a text box bound to a table

(OP)
Thank you for your help. The end goal of this database is to create a table of "work assignments" so yes, I do need to store this value in the table.  

txt2 does have a control source back to the table.

txt1 does contain the DLookup expression and works well.  You say I need to have another control or controls that should fire the AfterUpdate.  Can you explain or give examples of how to do this?

As far as additional information...]
The query that DLookup references is a parameter query that uses combo boxes on the form to fill the parameters.  It only returns one value, and that is the one that populates txt1.  

The form generates a unique ID that creates the unique "work assignment".  

I need to move the data to tx2 so that it can then be bound back to table.  

Any help is very appreciated.

 

RE: Moving DLookup results on form to a text box bound to a table

Quote (dhookom):

You must have some other control or controls that should fire the AfterUpdate to push the calculated value int txt2.

Quote (blondie41):

combo boxes on the form to fill the parameters

Duane
Hook'D on Access
MS Access MVP

RE: Moving DLookup results on form to a text box bound to a table

(OP)
Thanks for the answer, but it is still not working.  I hate being "that person", but I forgot to explain how I got the DLookup to work in the textbox.  I created a command button and added me.refresh which is how txt1 is populated.  Could this be part of the problem?  

 

RE: Moving DLookup results on form to a text box bound to a table

but it is still not working
Did you try my suggestion timestamped 30 Jan 12 8:33 ?

RE: Moving DLookup results on form to a text box bound to a table

(OP)
Yes - I tried it.  It does not work.  Nothing populates txt2.

RE: Moving DLookup results on form to a text box bound to a table

Can we assume the form has a record source?
Can you respond to "You might need to tell us more about your calculation, DLookup(), control sources, etc."?

If someone makes a suggestion such as PHV's, it is proper to reply whether or not it works and/or the results. We shouldn't have to ask.

Duane
Hook'D on Access
MS Access MVP

RE: Moving DLookup results on form to a text box bound to a table

(OP)
Sorry - I thought when I said "it is still not working" that was enough.  Please excuse me for not knowing the proper way to write it.

I do appreciate the help, but I am really struggling...

The form is bound to a table  - so I assume that would be considered the record source. I am using the form as a sort of "entry form"..the user goes through 3 comboboxes and those feed the query where txt1 does the DLookup and returns the value for txt 1.  However, in order to get txt 1 to populate, I have created a command button that performs me.refresh.  This works great.  However, no matter how many things I try, I cannot get txt1 to populate txt2 (which is bound back to the table).

Is that enough information?

RE: Moving DLookup results on form to a text box bound to a table

(OP)
Thank you so much.  I cannot even tell you how frustrated I have been for HOURS and HOURS.  I swear I tried this exact idea and it did not work.  However, I started from scratch and it works like a champ!  Sometimes you just need to slow down, ask for help and take a deep breath.     Bless You!
 

RE: Moving DLookup results on form to a text box bound to a table

blondie41,
You should consider thanking PHV by clicking the "Thank PHV" link. This also marks the thread as having been resolved.

Duane
Hook'D on Access
MS Access MVP

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close