Results 1 to 4 of 4
  1. #1
    sampson20 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    4

    Opening form from form but getting Pop Up

    I have two forms. I am trying to open a second form based on the information I click on on the first form.



    I am clicking on data in a field named "Lot_Number" and I want the second form to open with only data that contains that same "Lot_Number".

    The field in both forms is named "Lot_Number".

    I have tried 2 different VBA codes and an embedded Macro and I get the exact same result.

    In all instances I get a Pop Up window that shows the Data I clicked on. I then have to type the data I want into the text box. Once I type it in the second form pop up with the correct data. see attachment for picture of the Pop Up. The obvious problem is that I don't want to type this data in I just want it to filter automatically. I have seen the form to form question many times on this forum but never this type of issue. Please advise. If you need a copy of the program I can cut it down and post.


    The two VBAs are below:
    Code 1:
    Private Sub LOT_NUMBER_Click()
    Dim stDocName As String
    Dim stLinkCriteria As String
    Dim strOpenArgs As String

    stDocName = "Master Temp"


    stLinkCriteria = "[Lot_Number]= " & Me![LOT_NUMBER]
    strOpenArgs = Me![LOT_NUMBER]

    DoCmd.OpenForm stDocName, , , stLinkCriteria, , , strOpenArgs

    End Sub

    Code 2:
    Private Sub LOT_NUMBER_Click()
    DoCmd.OpenForm "Master Temp", , , "Lot_Number = " & Me.LOT_NUMBER
    End Sub
    Last edited by sampson20; 12-29-2010 at 07:49 AM.

  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,917
    I'm going to guess that Lot_Number is a string value so you need to surround the value with single quotes.
    "Lot_Number = '" & Me.LOT_NUMBER & "'"

  3. #3
    sampson20 is offline Novice
    Windows XP Access 2007
    Join Date
    Dec 2010
    Posts
    4

    Solved - Thanks

    RuralGuy --- That worked perfectly. I couldn't see the forest for the trees. I appreciate the help, greatly.

  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,917
    Excellent! Thanks for posting back with your success.

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

Similar Threads

  1. Replies: 1
    Last Post: 11-09-2010, 03:02 PM
  2. opening a second form from main/subform
    By PJPCVP in forum Database Design
    Replies: 1
    Last Post: 10-29-2010, 09:50 PM
  3. popup when opening a form
    By ajetrumpet in forum Forms
    Replies: 1
    Last Post: 10-08-2010, 09:33 AM
  4. Error In Opening Form
    By cwwaicw311 in forum Forms
    Replies: 1
    Last Post: 03-10-2010, 09:18 AM
  5. Replies: 1
    Last Post: 03-15-2009, 04:46 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