Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Subform and Parameter Value Request?? 1

Status
Not open for further replies.

Steven547

Technical User
Sep 15, 2004
165
US
Hey everyone. I have a subform that is based off a query, so I can perform a "keyword" search. The criteria in the query for that particular field is:
Like "*" & [forms]![SEARCHfrmGlossary].[txtKeywordSearch] & "*"

When I run that form by itself, it's fine. But when I add that form as a subform, and run it, it's asking for a value for the [forms]![SEARCHfrmGlossary].[txtKeywordSearch].

I'm thinking it has something to do with how the query is written (might have to add more to the above code), but I'm lost as to how to do it. Basically, if the "keyword" search field is blank or null on the SUBFORM (SEARCHfrmGlossary), then return all records, otherwise, only return the "like" function.

I was thinking along the lines of adding this to the query in the criteria:

iif([forms]![SEARCHfrmGlossary].[txtKeywordSearch] is null or "", [alldefinitions], Like "*" & [forms]![SEARCHfrmGlossary].[txtKeywordSearch] & "*")

But, it still asks for the parameter value of : [forms]![SEARCHfrmGlossary].[txtKeywordSearch] .

What am I doing wrong?

thanks.
 
If SEARCHfrmGlossary is a subform on a form, you will need to reference the main form then subform. Try something like:

Like "*" & [forms]![frmMain]![SEARCHfrmGlossary].[txtKeywordSearch] & "*" or [forms]![frmMain]![SEARCHfrmGlossary].[txtKeywordSearch] is Null

Duane
Hook'D on Access
MS Access MVP
 
Thanks. The problem I found out, is that both my forms are unbound. So I can't do a "parent - child" link between the two.

I'm thinking there has to be something in my query (code wise) that can be written...

Right now, the subform is based off a query which links back to a text field on the SUB form. The subform contains a "keyword" search field. I'm wondering if I should base my subform on a table, but how would I do the keyword search?
 
Steven547 . . .

You really need to [blue]put on your brakes and spend the necessary time to read the following links![/blue] ... that is if your going to make things easy on yourself and get to know the real deal! [thumbsup2] I promise you wont forget it! [thumbsup2]

Fundamentals of Relational Database Design

Normalizing Tables

Table Relationships


See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Steven547 said:
both my forms are unbound ... subform is based off a query
Do you understand what an unbound form is? If a form has a query as a recordsource then it is bound.

Perhaps you should start over and tell us more about what you have and what you need.

Duane
Hook'D on Access
MS Access MVP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top