Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Aug 2001
    London, UK
    Thanked 0 Times in 0 Posts

    Auto populate feild (Access 2000)

    Hi Guys,
    I'm sure I asked this question before but can't remember and not able to search for the answer so PLEASE <img src=/S/help.gif border=0 alt=help width=23 height=15> me again <img src=/S/bow.gif border=0 alt=bow width=15 height=15>
    I was wondering how I could auto populate a feild & store that data in the table.
    I have a main form and I enter the data there and then open another form using a button on the main form.
    Now what I want to do is to populate & store the link key that links both these tables in the second form.
    Is there a way of doing this??

    <img src=/S/help.gif border=0 alt=help width=23 height=15>


  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Thanked 31 Times in 31 Posts

    Re: Auto populate feild (Access 2000)

    There are several ways to do this.

    1. If you keep the main form open, you can refer to it on the other form. Let's say that your main form is called frmMain and that the info you want to transfer is in txtFeild. You can refer to this value as Forms![frmMain]![txtFeild]. For example, you could put code in the OnLoad event of the other form to populate a text box:

    Private Sub Form_Load()
    Me.[txtSomething] = Forms![frmMain]![txtFeild]
    End Sub

    2. You can also use the OpenArgs argument of DoCmd.OpenForm to pass information. For example, in the OnClick code of the command button:

    Private Sub cmdButton_Click()
    DoCmd.OpenForm FormName:="frmOtherForm", OpenArgs:=Me.[txtFeild]
    End Sub

    And in the OnLoad event of the other form:

    Private Sub Form_Load()
    If Not IsNull(Me.OpenArgs) Then
    Me.[txtSomething] = Me.OpenArgs
    End If
    End Sub

Posting Permissions

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