×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Contact US

Log In

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!

*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.

Students Click Here

Moving data from one form to another

Moving data from one form to another

Moving data from one form to another

(OP)
Any help is greatly appreciated.  I have two forms bound to two corresponding (and different) tables (Form A, Form B, Table A, Table B).

Form B is opened as a pop-up from a button on form A.  I would like for a particular field (ClientID) of the current record in form A to be "copied" to a corresponding field in form B.  the user will then type info in other fields in Form B and save the data to Table B.  Can anyone help me with this "copy"? Thanks in advance

RE: Moving data from one form to another

Hi Remel,

Are there any restrictions on the other fields in table b, like required set etc, there are numerous ways to do this.

create record sets based on the tables and loop through the first adding to the second. may need to use the refresh method so the updated records appear on the form.

or add append sql statement to the first form under an "Add" button and append  the records,

also i take it both table a and table b have parent tables if so you will need to add the parent key first ofcourse. or open the pop up adding this when it opens (not sure of the entire situation)

you could also add tag (yes/no) field to table a and use this to add "selected" entries only.

hth

Robert Dwyer
rdwyer@orion-online.com.au

RE: Moving data from one form to another

I have been trying to find a solution to this as well. Would you mind being a little less vague? THANKS!

RE: Moving data from one form to another

ALSO!
I put my question out in another forum, and this was the code that I was given to sort it all out. I have one table that is linked to some other ones by a customer Id. I want the same thing to happen. When you enter info into the first form, and then push the button to open the next one, there will either be: A. The related reccord because you already entered it, or B. a reccord with the related field all nicely filled in for you so you don't have to do it a million times. Maybe this will help you. (I can't seem to get it to work for me, but that's probably because I have very little VBA knowledge. Either that, or I'm a dolt.)

:

 Dim StrLinkCriteria As String   'Declare the variable StrLinkCriteria
    Dim stDocName As String         'Declare the variable stDocName
    stDocName = "Section B"         'Define stDocName
    
    'If there is already a record corresponding to the ApplicantID in Section B
    'Open the form with that record
    If DLookup("[ApplicantID]", "[Section B]", "[ApplicantID]=" & Forms![SECTION A]![ApplicantID]) Then
    'Define StrLinkCriteria, open the form in edit mode and requery the source for the form
        StrLinkCriteria = "[ApplicantID] = Forms![Section A]![ApplicantID]"
        DoCmd.OpenForm stDocName, , , StrLinkCriteria
        DoCmd.Requery
    'Otherwise open the form in add mode and set the OpenArgs value to the ApplicantID
    Else
        DoCmd.RunCommand acCmdSaveRecord
        DoCmd.OpenForm stDocName, , , , acAdd, , Me!ApplicantID

You just have to substitute your own table and form names.
What this does though is it first copies the applicantID to opening arguments then it looks to see whether a record exists and if not will create the new record with the same applicantID (which was copied to opening arguments)

HTH
Kate

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

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! Already a Member? Login

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