Results 1 to 2 of 2
  1. #1
    4 Star Lounger
    Join Date
    Feb 2002
    Thanked 0 Times in 0 Posts

    Open args (Access 2000)

    OpenArgs database

    I have downloaded from the magazine Inside Microsoft Acces a very useful programme called OpenArgs.
    It has only 2 tables, Customers and Orders.The form frmCustomers has a button called Customer Orders.
    If i want to see the orders for a given customer, i just press the button and here are the orders! A very
    useful program.
    I tried just to replace the tables with my tables, also called Customers and Orders, but the program doesnt

    work.I receive the message " the Open Form action was cancelled", and the debug shows that the

    following line is not in not good :

    DoCmd.OpenForm "frmOrders", , , "CustomerID = '" & Me.CustomerID & "'", , , Me.Name

    Since the program works with the orginal tables, but not with mine, obviously the fault is with my tables.
    My table Customer has an autonumber, while the original table the data type is Text.I cannot see any
    other difference in the tables.Can somebody help me?
    The code s contained in the form frmCustomers are the following:
    Public ReturnTo As String

    Private Sub Form_Open(Cancel As Integer)
    ' Test the OpenArgs property to see if it has a value
    ' If it is empty, set ReturnTo to the Switchboard form.
    ' Otherwise, set ReturnTo to the string passed in OpenArgs.
    If Len(Me.OpenArgs & "") > 0 Then
    ReturnTo = Me.OpenArgs
    ReturnTo = "frmSwitchboard"
    End If

    End Sub

    Private Sub cmdOrders_Click()
    ' Open the Orders form
    DoCmd.OpenForm "frmOrders", , , "CustomerID = '" & Me.CustomerID & "'", , , Me.Name
    ' Hide the Customers form
    Me.Visible = False
    End Sub

    Private Sub Form_Close()
    ' Open the form whose name is stored in the ReturnTo property
    DoCmd.OpenForm ReturnTo
    End Sub

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Open args (Access 2000)

    Change it to this:

    <pre>DoCmd.OpenForm "frmOrders", , , "CustomerID = " & Me.CustomerID , , , Me.Name </pre>

    You don't want the single quotes around the CustomerID value if it isn't text.

Posting Permissions

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