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!

setting default values in a form 1

Status
Not open for further replies.
Jun 1, 2006
58
US
Hi all,

I have been trying to set a default value in a text field in an access form, but something seems to be goin wrong and I am not sure what.

Basically, I have a text field in a form whose value is passed as a parameter to a query, which generates results that are displayed in a report.

I want the default value of this text field to be set to ALL, so that all values in one column in a table are passed to the where clause in the query. Like so,

where xyz in (Forms!frm1!txtbxId)

and I want that value to be ALL. When the user types something in , I want just that value to be passed to this where clause.

These values are text values. When I try setting the default as

tbl.column

where tbl is the table and column is the column whose values are to be passed, I get no answer. I also tried setting the defaul value to be a subquery which generates all values in the column in the table, but that did not work either.

Can anyone pls help?

Thanks
 
Simply let the DefaultValue of txtbxId to be Null and use the following criteria for xyz:
SELECT ...
FROM ...
WHERE (xyz=[Forms]![frm1]![txtbxId] OR [Forms]![frm1]![txtbxId] Is Null)

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top