Property Not Found 3270

sumdumgai

Registered User.
Local time
Today, 05:52
Joined
Jul 19, 2007
Messages
453
Need help please. Created a form with buttons that work fine for me. The form is on a front-end database that is linked to a back-end on a remote server. When I mail the front-end db to an end-user, he can link to the back-end, but when he opens the form and clicks on the 'search' button, he gets the 3270 error. Here's the code:
Code:
Private Sub SearchF_Click()

    DoCmd.Close acQuery, "SearchQ", acSaveNo
    Dim db As Database
    Dim rs As DAO.Recordset
    Dim strSql As String
    Set db = CurrentDb
    
    If Me.[TEST] = "" And Me.fName = "" And Me.[Address1] = "" And Me.City = "" And Me.Zip = "" And Me.St = "" Then
        GoTo endsub
    End If
        
    strSql = "SELECT [TEST_Data].[TEST #], [TEST_Data].Name, [TEST_Data].[Address 1], [TEST_Data].[Address 2], [TEST_Data].City, [TEST_Data].Zip, [TEST_Data].St " _
        & "FROM [TEST_Data] " _
        & "WHERE [TEST_Data].[TEST #]  Like '*" & Me.[TEST] & "*' " _
        & "And [TEST_Data].Name Like '*" & Me.[fName] & "*' " _
        & "AND [TEST_Data].[Address 1] Like '*" & Me.[Address1] & "*' " _
        & "And [TEST_Data].City Like '*" & Me.[City] & "*' " _
        & "AND [TEST_Data].Zip Like '*" & Me.[Zip] & "*' " _
        & "And [TEST_Data].St Like '*" & Me.[St] & "*' "
    
    With CurrentDb.QueryDefs("SearchQ")
        .SQL = strSql
    End With
    
    DoCmd.OpenQuery "SearchQ"
   
endsub:
End Sub


I'm new to Access Forms, so if I need to do anything else to clean up or make this code more usable to other users, please help. How do I identify which property is not being found?
 
try using

dim db as dao.database

he should open the test_data table if all the fields are correct on the query string.
 
what is the error description? will usually say which property

also, does the code stop on a particular line? if so, which?

why set db=currentdb when you never use it?

Name is a reserved word, using it as a field name can generate misleading errors

you should not use non alphanumeric characters in field names (#), it also can result in misleading errors

Is you colleague using the same version of access? if not, they may have a missing library
 
I would also change this to
Code:
With CurrentDb.QueryDefs("SearchQ")
        .SQL = strSql
    End With


Code:
Db.QueryDefs("SearchQ").SQL = strSql

However, if this works on your machine and not theirs I doubt there is anything wrong with code.
 
I made the change that arnelgp suggested and will wait for the user to test.



To CJ, the missing property is not displayed in the error message, and the error line is not displayed either. I built code using Access 2007 (though I have Access 2013 on another device), and the user is on Office 365.
 

Users who are viewing this thread

Back
Top Bottom