Trying to Search a form using a macro and get property error

S

Sab

Hi,

I recently converted all my databases from Access97 to 2003. As part of the
database end users have been able to search a field on a form by double
clicking a text box and a search form appears that runs a macro. In the 97
database the macro was:

Set Value
Item: [Visible]
Expression: "NO"

Find Record
Find What: =[Search String]
Match: Any Part of Field
Match Case: No
Seach: All
Search as Formatted: No
Only Current Field: Yes
Find First: Yes

Set Value
Item: [Visible]
Expression: "Yes"

This causes an error stating "You entered and expression that has and
invalid refernce to the porperty visible?

Was there a programming change from 97 to 2003. Do you have any
recommendations on how to get this working?

Thanks for any help!
 
S

Sab

Hi Again,

Also I forgot to mention that if I convert the database from 97 to 2000, I
do nto encounter this problem??
 
S

Steve Schapel

Sab,

Try putting the Yes and No for the Expression arguments of the SetValue
actions, without the ""s.

I was not aware of any programming change... let's just say that I am
surprised it ever worked with "Yes" and "No" :)
 
S

Sab

Hi,

Thanks for the tip unfortunately it is still not working.

Do you have any other ideas?


Steve Schapel said:
Sab,

Try putting the Yes and No for the Expression arguments of the SetValue
actions, without the ""s.

I was not aware of any programming change... let's just say that I am
surprised it ever worked with "Yes" and "No" :)

--
Steve Schapel, Microsoft Access MVP
Hi,

I recently converted all my databases from Access97 to 2003. As part of the
database end users have been able to search a field on a form by double
clicking a text box and a search form appears that runs a macro. In the 97
database the macro was:

Set Value
Item: [Visible]
Expression: "NO"

Find Record
Find What: =[Search String]
Match: Any Part of Field
Match Case: No
Seach: All
Search as Formatted: No
Only Current Field: Yes
Find First: Yes

Set Value
Item: [Visible]
Expression: "Yes"

This causes an error stating "You entered and expression that has and
invalid refernce to the porperty visible?

Was there a programming change from 97 to 2003. Do you have any
recommendations on how to get this working?

Thanks for any help!
 
S

Steve Schapel

Sab,

Yes, I do. The Item argument is also not valid. You need to indicate
what you want to make visible or not, for example...
[NameOfTextbox].[Visible]

Also, with a FindRecord macro action (note, it is not Find Record), you
normally need to set the focus to the control that the search value
pertains to. You normally use a GoToControl action within your macro,
before the FindRecord action, for this.

If you still can't get it, please let us know some more details of what
is happening... Which event of which control/object is the macro
triggered from? What and where is [SearchString]? What is the "search
form" that you mentioned? Which field in your form's record source is
the search supposed to relate to? Etc.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top