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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Setting Default Value to a Query Field

Status
Not open for further replies.

jpalmer150

Technical User
Jul 1, 2003
46
0
0
US
I'm trying to set the default value for a control to be a value from a query. The query is filtered based on the key field therefore there will always be just one record.

My coding currently is as follows:

Default Value = [QrySel_User_Preferences]![Show_Rejected]

Unfortunately this is not working.

Any suggestions? JP
 
Hi,
Perhaps you should try using a DLookup function instead. I wrote an FAQ on how to use DSum, which is almost exactly the same as DLookup. DLookup only returns the value of one field. See faq703-3066

HTH, [pc2]
Randy Smith, MCP
rsmith@cta.org
California Teachers Association
 
Try this:

Code:
[i]controlname[/i].DefaultValue = DLookUp("[Show Rejected]", "QrySel_User_Preferences")

The DLookup function can be used to return a value from a table or a query. There is a third parameter if more than one record is available in the recordset but since you said that there would only be one i left it off.

Bob Scriver
[blue]Want the best answers? See FAQ181-2886[/blue]


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top