Results 1 to 6 of 6
  1. #1
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58

    Unanswered: DLookup - Invalid Outside Procedure

    I have a table with the following fields:
    Lien_ID, Lien_Name, Lien_Address1, Lien_Address2, Lien_City, Lien_State, Lien_Zip.

    I have a combo box that when I select the Lien_ID I want the other fields to populate in my form.

    Private Sub cmbLienHolderName_AfterUpdate()

    Dim vntFilter As Integer
    vntFilter = Lien_ID


    Me!txtLienAddress1 =DLookup("Lien_Address1", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienAddress2 = DLookup("Lien_Address2", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienCity = DLookup("Lien_City", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienState = DLookup("Lien_State", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienZip = DLookup("Lien_Zip", "tblLienHolder", "Lien_ID = " & vntFilter)

    End Sub

    When I select the Lien_ID I get the following error message:

    Invalid Outside Procedure...

    Thanks..

  2. #2
    Join Date
    Jan 2004
    Location
    South Africa
    Posts
    178

    Re: DLookup - Invalid Outside Procedure

    Originally posted by odamsr
    I have a table with the following fields:
    Lien_ID, Lien_Name, Lien_Address1, Lien_Address2, Lien_City, Lien_State, Lien_Zip.

    I have a combo box that when I select the Lien_ID I want the other fields to populate in my form.

    Private Sub cmbLienHolderName_AfterUpdate()

    Dim vntFilter As Integer
    vntFilter = Lien_ID


    Me!txtLienAddress1 =DLookup("Lien_Address1", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienAddress2 = DLookup("Lien_Address2", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienCity = DLookup("Lien_City", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienState = DLookup("Lien_State", "tblLienHolder", "Lien_ID = " & vntFilter)
    Me!txtLienZip = DLookup("Lien_Zip", "tblLienHolder", "Lien_ID = " & vntFilter)

    End Sub

    When I select the Lien_ID I get the following error message:

    Invalid Outside Procedure...

    Thanks..
    try this:
    unbound the combobox
    then:

    Private Sub cmbLienHolderName_AfterUpdate()

    Dim rs As Object
    Dim num As String
    num = Me![cmbLienHolderName]
    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Lien_ID] = " & num
    Me.Bookmark = rs.Bookmark

    End Sub

  3. #3
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58
    I tried that and I am getting the same error message. Do I need to add some type of reference for the project? I don't know if this matters but I am using a project to connect to sql instead of an access database.

  4. #4
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1

    Re: DLookup - Invalid Outside Procedure

    Originally posted by odamsr

    vntFilter = Lien_ID
    I think the problem is here, not with the DLookup.

    Try being explicit with the Lien_ID. Me thinx access is trying to find a procedure called Lien_ID since you haven't explicitly said that it's a combo box value. Try this:

    vntFilter = YourCombo.Value

  5. #5
    Join Date
    Mar 2004
    Location
    Atlanta, GA
    Posts
    58
    Thanks Teddy that worked. I know it was something stupid.

    Thanks again

  6. #6
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Originally posted by odamsr
    Thanks Teddy that worked. I know it was something stupid.

    Thanks again
    It's monday.
    Glad I could help.


Posting Permissions

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