"Enter parameter" - but not if VBA is open... (1 Viewer)

Chrisopia

Registered User.
Local time
Today, 05:09
Joined
Jul 18, 2008
Messages
279
It's an annoying, random occurrence, which has no apparent cause.

I have a search tool which opens when the application begins.

It begins with an Open event:
Code:
Private Sub Form_Open(Cancel As Integer)
    
    Me.SearchBox.Value = Me.SearchBox.ItemData(1)

    Me.Requery
    
End Sub

Followed by a Load Event:
Code:
Private Sub Form_Load()
Me.AZSort.Visible = True
Me.ZASort.Visible = False

TheLocation = ")"

TheSQL = "SELECT * FROM [tblCustomers] " _
        & "WHERE (((tblCustomers.[Company Name]) Like ""*"" & [Forms]![frmSearch]![SearchHidden] & ""*"")" & TheLocation & " " _
        & "OR (((tblCustomers.Firstname) Like ""*"" & [Forms]![frmSearch]![SearchHidden] & ""*"")" & TheLocation & " " _
        & "OR (((tblCustomers.Surname) Like ""*"" & [Forms]![frmSearch]![SearchHidden] & ""*"")" & TheLocation & " " _
        & "OR (((tblCustomers.Keyword1) Like ""*"" & [Forms]![frmSearch]![SearchHidden] & ""*"")" & TheLocation & " " _
        & "OR (((tblCustomers.Keyword2) Like ""*"" & [Forms]![frmSearch]![SearchHidden] & ""*"")" & TheLocation & " " _
        & "OR (((tblCustomers.Keyword3) Like ""*"" & [Forms]![frmSearch]![SearchHidden] & ""*"")" & TheLocation & " " _
        & "ORDER BY [CustomerID];"

Me.SearchBox.RowSource = TheSQL
    Me.SearchBox.Value = Me.SearchBox.ItemData(1)

    Me.Requery
End Sub

I get a message "Please enter Parameter" then it asks for Form!frmSearch!SearchBox
and
Form!frmSearch!SearchBoxHidden


If I click ok, and leave it blank, I get an "on open Event" error.
"The Expression On Open you entered as the Event Property setting produced the following error: "...

I say its random, because i don't change anything then suddenly it will appear. And it wont go unless
a) VBA is open in the background, then everything works
or
b) I Copy and paste all my forms and queries into a fresh access file until it comes back

But I havent changed anything!?:banghead:
 

JHB

Have been here a while
Local time
Today, 14:09
Joined
Jun 17, 2012
Messages
7,732
When do you get the message, in the form open/load or ????
Have you tried to put ind a DoEvents in the form open/load?

If you have some sample data, then post the database with only the requeried forms/code in.
 

Users who are viewing this thread

Top Bottom