Results 1 to 4 of 4
  1. #1
    joacro is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    4

    Subform to automatically take Id

    Hi there,

    I got a form with a subform on.
    The form is for clients
    The subform is for notes


    On the subform there is the following
    ID, ClientID, Date Capture, Note
    I have created a button to add a note. The button brings up the note form.
    Say I am in Piet's(my client) form and wishes to add a note. I press the button and up comes the notes form. Now I need to enter all the detail,
    What can I do to automatically add the ClientID(piet's) in the ClientID field.

    Currently I need to choose it from the combo box.

    Thank in advance

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Maybe this link will help: http://www.baldyweb.com/OpenArgs.htm

  3. #3
    joacro is offline Novice
    Windows Vista Access 2007
    Join Date
    Feb 2011
    Posts
    4
    Hi there,
    Thank you for the quick reply.

    I can't get it to work.

    My forms name is Broker
    My subform is Brokers Assistant

    When I select Add Assistant the Brokers assistant form pops up

    The value that I need to have pre-entered is
    BrokerID which is on the main form named Broker

    What I did is:

    Click on Add Assistant - on click event
    Private Sub cmdaddass_Click()
    If Me.NewRecord Then
    DoCmd.OpenForm "Brokers Assistant"
    Else
    DoCmd.OpenForm "Brokers Assistant", , , , , , Me.BrokerID & ""
    End If
    End Sub


    And on the Brokers Assistant form on load event
    Private Sub Form_Load()
    Dim strBrokersAssistant() As String
    If Not IsNull(Me.BrokersAssistant) Then
    strBrokersAssistant = Split(Me.BrokersAssistant, ";")
    Me.BrokerID = strBrokersAssistant(0)

    Else
    Me.txtOtherInfo = "Unknown"
    End If
    End Sub

    It doesn't seem right,

    Hope someone will be able to help me

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Remove the trailing quotes:
    DoCmd.OpenForm "Brokers Assistant", , , , , , Me.BrokerID & ""
    ...should be:
    DoCmd.OpenForm "Brokers Assistant", , , , , , Me.BrokerID
    .
    Then the receiving form code should be:
    Code:
    Private Sub Form_Load()
    If Not IsNull(Me.OpenArgs) Then
       Me.BrokerID = Me.OpenArgs
    Else
       Me.txtOtherInfo = "Unknown"
    End If
    
    End Sub

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

Similar Threads

  1. Pass Subform filter to subform in report
    By camftm in forum Programming
    Replies: 16
    Last Post: 07-19-2011, 07:12 AM
  2. Write Code to Navigate from Subform to Subform
    By Swilliams987 in forum Programming
    Replies: 22
    Last Post: 02-04-2011, 11:30 AM
  3. Automatically do... everything?
    By .:SoundWave:. in forum Access
    Replies: 4
    Last Post: 12-11-2010, 07:41 PM
  4. Replies: 15
    Last Post: 11-09-2010, 04:27 PM
  5. How to Automatically Group
    By SSgtJ in forum Reports
    Replies: 3
    Last Post: 05-17-2010, 12:25 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