Page 2 of 2 FirstFirst 12
Results 16 to 29 of 29
  1. #16
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    That's not the name of your field, and there are too many single quotes:



    DoCmd.OpenForm "Building+Assets", , , "[Building ID] = " & Me.txt_BuildingID

    The spaces and symbols in your names are not a good idea.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  2. #17
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Thank you mate,

    I think im complete newbie when it comes to VBA, i tried the code, but still pops up with the box asking to enter the value... (( Its so frustrating. Could you please edit the piece of code i have in my latest copy of the db, i you have a spare minute. Would be much appreciated. .. the boss is getting on my nervous with this thing

    The file is attached

    Many thanks

  3. #18
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Pbable I figured it out !!! Oh, god thank for you help. You are my hero ))!!

  4. #19
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Could you explain me why for the Second form I had to assigned the Record Source Name in VBA [Building ID], not the field name txtBuildingID.. but for the intial Record i assigned the field name txtBuilding... ?? Thats why i couldnt figured it out for so long, i was keep assigning the wrong name ) lol

  5. #20
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    The field name (in the table) is [Building ID]. The name of the control (text box) on the form is txt_BuildingID. The wherecondition argument is a SQL "where" clause without the word "where", which would be along the lines of

    WHERE FieldName = 123

    so the first part needs to be the field in the table, and the second part needs to be the form control where the value 123 can be found.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  6. #21
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Great !! you are real lifesaver

  7. #22
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  8. #23
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Hey mate, just a quick question - what is the function that would refresh the content of the second form before opening? because i have to save the content of the Building Form before i can go ahead and hit "View Asset Register", and see the information.

  9. #24
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Not clear on what you mean. The second form would get fresh data when opened. If you mean saving the contents of the first form before opening the second:

    DoCmd.RunCommand acCmdSaveRecord

    or

    If Me.Dirty Then Me.Dirty = False
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  10. #25
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    yeah, that what i meant And i would i apply it to Building Form in onDirty event? Thank you for help

  11. #26
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Personally I'd probably have it behind that button, so it saves the record before opening the other form.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  12. #27
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    Thanks a lot, your help is priceless

  13. #28
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Tell that to my boss, will ya?
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  14. #29
    Evgeny's Avatar
    Evgeny is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Apr 2010
    Posts
    85
    haha, sure thing tell him to get a pay rise hehe... Thank you for all your help, making my life easier lol. Really want to learn Access and VBA, but its hard to do it by yourself

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Form Auto population
    By Evgeny in forum Access
    Replies: 3
    Last Post: 04-08-2010, 05:17 PM
  2. Auto Formatting Text in a Form
    By swicklund in forum Access
    Replies: 0
    Last Post: 07-23-2009, 01:15 PM
  3. Automatic field check and population
    By danidin in forum Forms
    Replies: 0
    Last Post: 01-03-2009, 12:45 PM
  4. Auto populate fields on a form
    By ldarley in forum Forms
    Replies: 0
    Last Post: 08-14-2008, 09:39 AM
  5. Auto Scroll in a Form
    By delliott777 in forum Forms
    Replies: 0
    Last Post: 05-31-2008, 07:02 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums