Results 1 to 9 of 9
  1. #1
    Poker4dbs is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    5

    Can someone point to to a tutorial

    I'm looking for a clear and easy to understand tutorial on how to pass a field value from one form that has client information (client ID) to a new form that has client visits (Client ID) via a button. So that the user does not have to go back and find the clients Id every time there is a new visit. I have very limited VB skills but can grasp it if explained well. Thanks.

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    A closed form has no data. So assuming the ClientInfo form is open - and there is a value in the ClientID field : then for the new ClientVisits forms the reference you would use is: Forms!ClientInfo.ClientID

    so lets say the ClientVisit forms is just opening - in the OnLoad event you can put:
    Me.ClientID = Forms!ClientInfo.ClientID

    hope this helps.

  3. #3
    rpeare is offline VIP
    Windows XP Access 2003
    Join Date
    Jul 2011
    Posts
    5,442
    Are you keeping the original form open or closing it when you open the new form? Are you using the clientID field to limit your data set on the second form so that you only see records for that client? If so have you thought about using a subform? Subforms allow you to see the relevant information for your client on the same form without having to open a new one.

  4. #4
    Poker4dbs is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    5
    A subform would make it too jumbled as I will have other option buttons from the ClientInfo forms.

    Im using Access 2007 and in the event tab there is no onload ??? Am I missing something?

  5. #5
    Poker4dbs is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    5
    And when I put that into the onclick event it came back with an error connet find object 'Me.' ???

    Edit: and the clientinfo form is open. also the database itself is sql express 2008 linked to the access front end, not sure if that makes a difference.

  6. #6
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by Poker4dbs View Post
    And when I put that into the onclick event it came back with an error connet find object 'Me.' ???
    That would tend to indicate that you put the code in the event PROPERTY instead of in the VBA Window.


    See here for more about that (this shows 2003 but 2007 is somewhat similar so you should be able to figure it out):
    http://www.btabdevelopment.com/ts/eventcode

  7. #7
    Poker4dbs is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    5
    could you give me an example of what the code would look like?

  8. #8
    boblarson is offline --------
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jun 2011
    Posts
    1,272
    Quote Originally Posted by Poker4dbs View Post
    could you give me an example of what the code would look like?
    Exactly what NTC gave you:

    Me.ClientID = Forms!ClientInfo.ClientID

  9. #9
    Poker4dbs is offline Novice
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    5
    Nevermind... I got it working. Thank you everyone for your assistance!

    Edit: I made that much harder than it should have been. lol

Please reply to this thread with any new information or opinions.

Similar Threads

  1. need Free tutorial
    By newtoAccess in forum Access
    Replies: 4
    Last Post: 10-26-2011, 12:00 PM
  2. VBA tutorial
    By gap in forum Programming
    Replies: 2
    Last Post: 07-14-2011, 07:34 AM
  3. Can someone recomend a ground up VBA tutorial?
    By JeffG3209 in forum Access
    Replies: 4
    Last Post: 06-03-2011, 06:55 PM
  4. What is the point of different modules?
    By cowboy in forum Programming
    Replies: 3
    Last Post: 03-29-2010, 10:43 PM
  5. Replies: 1
    Last Post: 10-05-2009, 06:52 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