Results 1 to 6 of 6
  1. #1
    joefonseca79 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    7

    Button on Subform to pickup ClientVisitID as Key

    I was wondering if someone could give me some advise on what I’m doing wrong.



    I have 3 tables
    Client
    Type: AutoNbr Txt
    Fields: ClientID, Name
    ClientVisit
    Type: AutoNbr Nbr Nbr
    Fields: ClientVisitID, ClientID, VisitNbr
    ClientImg
    Type: AutoNbr Nbr OLE
    Fields ClientImgID, ClientVisitID, Image

    I have 3 forms
    Client
    ClientVisit
    ClientImg

    Client is the main form and has ClientVisit as the subform. They are keyed on ClientID

    Inside ClientVisit I have a button that I want to open FormClientImg taking the ClientVisitID and populating it for the ClientImg table.

    I have attached a sample db for reference


    I can send a sample db if anyone needs or ping me back for any other questions.

    Thanks in advance.

    Joe

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    sorry, I don't look at attachments. Not sure I understand but once the new FormClientImg is open then it is a matter of selecting a trigger event - perhaps the user will always be keying in some field; and in that event simply write the ID by calling it from the other open form. Here is the syntax:

    Me.IDcontrolname=Forms!ClientFormName.ClientIDCont rolName

    hope this helps.

  3. #3
    joefonseca79 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    7
    I tried the following but i'm getting a run-time error 2450. Can't find the form 'FormClientVisit' referred to in a macro expression or VB code..

    I added this to the FormClientVisit On Open

    Private Sub Form_Open(Cancel As Integer)

    ''This syncs the id's
    Me.clientvisitID = Forms!FormClientVisit!clientvisitID


    End Sub

  4. #4
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    FormClientVisit On Open ?? if the form is not yet open then you can't refer to a control on it.

  5. #5
    joefonseca79 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    7
    So I need to put that code on the button that they click to open the subform?

  6. #6
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    ClientImg must have cross reference to client via the ClientID. right? so you need to put the ClientID value into a field in ClientImg - - some how, some way. b.t.w. I don't see a ClientID field in ClientImg. That is the fundamental point. I don't know the particulars of how the user is going to interact with the application. My first post gave one example of doing it by triggering a call of that value when one is in ClientImg. When you put in the image info - you need also to put in the ClientID value.

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

Similar Threads

  1. Replies: 1
    Last Post: 07-27-2010, 02:27 PM
  2. Replies: 0
    Last Post: 07-26-2010, 04:36 PM
  3. Replies: 6
    Last Post: 02-09-2010, 07:53 AM
  4. command button to filter a subform issue -
    By countdrako in forum Forms
    Replies: 1
    Last Post: 12-09-2005, 11:58 PM
  5. Open a linked subform with a command button
    By flablueeyedblond in forum Forms
    Replies: 0
    Last Post: 11-18-2005, 01:18 PM

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