Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2004
    Location
    Illinois
    Posts
    9

    Unanswered: Copying data from table 1 to table 2

    This may be really simple but I just can't figure it out. Following is what I am trying to do:

    Form1
    Field - InspectionID - autonumber

    Form2
    Field - InspectionID - text

    I want to have a button on Form1 that opens Form2 and automatically takes the data from the InspectionID field on Form1 and enters it in the InspectionID field on Form2.

    I have tried everything that I can think of and can't get it to work. Granted, I am no Access expert. Just trying to teach myself as I go.

  2. #2
    Join Date
    Sep 2003
    Location
    MN US
    Posts
    313
    You're trying to put an autonumber type (long integer) into a text field, which is probably the problem you're having.

    You can put this in the OnOpen event of form2, it'll convert the autonumber to text (string)...

    Me!InspectionID = Str(Forms!Form1!InspectionID)


    Good luck

    Chris

    Edit: You mentioned you're new to access...and this scenario sounds like you may not have a good table/relationship structure. Normally you wouldn't store redundant data in 2 tables. There's about a billion posts here on normalization. Or if InspectionID in Form2 is a foreign key, consider changing the data type to long integer. Sorry if I'm off base here.
    Last edited by cpgospi; 02-11-05 at 12:28. Reason: Addition

  3. #3
    Join Date
    Jun 2004
    Location
    Illinois
    Posts
    9
    cpgospi,

    thanks for the response and I will try this, most likely this afternoon. Also, I am new but do understand what you are saying. Unfortunately, I am working with a DB that was created by someone else and has a lot of data already in it. I am trying to fix things quickly with what I have to work with. I may end up starting from scratch, doing things correctly though if I can't get beyond some of these problems I keep encountering.

    Again, thanks for your help. I'll respond with the results.

    Landon

  4. #4
    Join Date
    Dec 2003
    Location
    Dallas, TX
    Posts
    1,004

    Talking

    lab-one Landon[/QUOTE]

    Hi Landon and "Welcome to the Forum"
    Reading your situation may I quickly advise you that you should look into getting your database in the proper order as fast and as correctly as possible. The longer you wait, the more data you collect, the more problems you will soon have to try to work your way out of. Just for the sake of getting some practice in, go ahead and create you a new well structured database with a well laid out and planned for the future structure. Then you might be able to Import the data from the Tables you have already, (after picking them apart to fit into your new one). It might take a bit of doing, but I think you'll be better off in the long run. Friendly advise from another forum poster.

    have a nice one,
    BUD

Posting Permissions

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