Results 1 to 11 of 11
  1. #1
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Auto Populate (A2K)

    Simple question I'm sure, but I've been messing with it for a couple hours now and can't figure it out. I have my form and subform and I want the Library # in my subform to fill in with the same value that I enter in the Library # on the main form. I know there is some easy VBA code or something that should allow this but for some reason I can't get it to work. Thanks in advance.

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Auto Populate (A2K)

    You need to have Library# as the linking fields between the form and subform. Look at the properties of the subform control that sits on the mainform (NOT the subform itself). Look on the Data tab of the properties box, and you will see the Linked Child Fields and the Linked Master Fields. And I'd advise you to lock that Library# field in the subform so it can't be changed. (Actually, in a form/subform situation like that, I wouldn't even be displaying the Library# in the subform).
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Populate (A2K)

    It doesn't work. This is a proble I have been having for a while. When I first linked the original ID fields it worked for about the first 2 times I entered data. After that the link just stopped working. Any possible idea's on why?

  4. #4
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Auto Populate (A2K)

    It shouldn't stop working, unless you changed the Linking fields. Assuming you have a bound form, I'd make sure the control on the mainform that was bound to Libary# was named something else (like "txtLibrary"). Same for control on subform. And is your control really name Library# (with the pound sign)? This isn't a good idea, but you should always use the syntax [Library#] (using square brackets).
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  5. #5
    3 Star Lounger
    Join Date
    Mar 2001
    Location
    Frederick, Maryland, USA
    Posts
    296
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Populate (A2K)

    Could this be as simple as making the Control Source or Default Value of the subform field [Me]![Library#]?

  6. #6
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Populate (A2K)

    when I link them it is using the field name not the text box controls name. So i don't see how me changing the text boxes name to txtPLibrary for the publishing table, and txtRLibrary for the record table would matter. Either way I finally got fed up with it and added this code in the txtPLibrary_AfterUpdate action code.

    txtRLibrary = txtPLibrary.Value

    It seems to be working right now, and I don't have anything else that has been working so I'll just keep this for now.

  7. #7
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Populate (A2K)

    bah, I get one problem fixed and I run into another dealing with the same thing. Ok I managed to get my whole delete button working, by setting my Child field, and Master field on my subform to the field I wanted and then setting up the relationships of the tables. Anyway when I did this my Autopopulate for my Library # stopped working. Any idea's why this would have happend?

  8. #8
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Populate (A2K)

    I guess I should mention I need the ID number to populate automatically (which it does) AND the Library #. So this I guess can be confusing. However, if I just set another Master field, and Child field on the sub form with the Library # would it work?

  9. #9
    2 Star Lounger
    Join Date
    May 2002
    Location
    USA
    Posts
    190
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Populate (A2K)

    Well I set another child link and master link to the Library # field and it did nothing. I am ready to throw my computer out the damn window. <img src=/S/scream.gif border=0 alt=scream width=15 height=15>

  10. #10
    New Lounger
    Join Date
    Mar 2004
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Auto Populate (A2K)

    I had the same problem, if I left any of the fields I had set up as parent and child blank then the record would disappear from my subform when I refreshed it, however a record was created. When I ensured all the fields had information it worked, but if I changed any of the information in the linked fields again teh record would disappear from my subform. I am looking at some scripting to run to update the fields I want to update and view but not loose once I change information

  11. #11
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Auto Populate (A2K)

    Welcome to Woody's Lounge!

    Can you provide some details of the record sources of the main form and subform, and the fields involved? Thank you.

Posting Permissions

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