Results 1 to 5 of 5
  1. #1
    Join Date
    Sep 2008
    Posts
    150

    Unanswered: Can't populate data from two fors based on common IDs

    Hi,

    I have an issue trying to populate data from thee main form based on it's ID.

    I have a main input form that I use to enter data. I would like to launch another form using the ID as the common link so that I can see limited data from the input form. I used the wizard to find specific data to display and got the code (below). The form opens, but it is blank. I would like to open the “frm_Rejected_WO_Date” form with the record ID that I have on the main form. Not too familiar with VBA so not sure what I am missing.

    <End CODE>

    Private Sub Air_Test_Click()
    On Error GoTo Air_Test_Click_Err

    DoCmd.OpenForm "frm_Rejected_WO_Date", acFormDS, "", "[ID]=" & ID, , acNormal

    Air_Test_Click_Exit:
    Exit Sub

    Air_Test_Click_Err:
    MsgBox Error$
    Resume Air_Test_Click_Exit

    End Sub
    <End CODE>

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    First thing I see is that the argument you have for the WindowMode Parameter...acNormal...is not a valid argument! It needs to be acWindowNormal:

    Code:
    DoCmd.OpenForm "frm_Rejected_WO_Date", acFormDS, "", "[ID]=" & ID, , acWindowNormal


    Correct this and see what happens.

    Once you've got that corrected, if the problem still persists, check to see whether or not the ID Field is defined as a Number Datatype in the underlying Table. The syntax you're using for the Where parameter

    "[ID]=" & ID

    is correct if it is defined as a Number...but incorrect if it is defined as Text. If ID is defined as Text, the syntax would be

    "[ID]='" & ID & "'"

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    Sep 2008
    Posts
    150
    Hello Missinglinq,

    I changed to acWindowNormal and it still opens a blank record. The ID is an AutoNumber ID (Long Integer), and both forms are pulling from the same table.

  4. #4
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    Quote Originally Posted by mlrnet View Post
    Hello Missinglinq,

    I changed to acWindowNormal and it still opens a blank record. The ID is an AutoNumber ID (Long Integer), and both forms are pulling from the same table.
    Not possible.
    If the same value is being used as a PK in more than one table then it can only be AUTONUMBER in one table and an equivalent data type in other tables. In Access that means the other tables must be long integer
    I'd rather be riding on the Tiger 800 or the Norton

  5. #5
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Quote Originally Posted by healdem View Post

    ...If the same value is being used as a PK in more than one table then it can only be AUTONUMBER in one table and an equivalent data type in other tables...
    You missed this part:

    Quote Originally Posted by mlrnet View Post
    ...both forms are pulling from the same table...
    If this part

    Quote Originally Posted by mlrnet View Post
    ...I have a main input form that I use to enter data. I would like to launch another form using the ID as the common link so that I can see limited data from the input form...not sure what I am missing...
    is referring to entering a New Record and then clicking on the Air_Test Command Button, you probably need to Save the Record first, then open the secondary Form:

    DoCmd.RunCommand acCmdSaveRecord

    Also, make sure that the Data Entry Property of the secondary Form is set to No.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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