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!

quaries and text box defaults

Status
Not open for further replies.

traffas

Programmer
Feb 27, 2002
42
0
0
US
Is it possible to set the default value of a text box to the results of a quary?

Something like:
default =[name of quary].[name of field]

when I try it, it will open and run the quary but will not set the text box value to the number.............

Many thanks in advance
Shawn
 
yes you can...

use "!" instead of "."

--------------------
Procrastinate Now!
 
Where are you doing this traffas ?

I don't believe that you can do 'exactly' what you posted - but there are ways around these things. After all, there more than one way to skin a cat
( But it still tastes like chicken. )

If the results of the query are constant once the form is opened you could put some code in the Form's On_Open event to set the text box default value.

Or put similar code in the On_Activate event if the value changes when the form is de-activiated.

etc..


'ope-that-'elps.



G LS
spsinkNOJUNK@yahoo.co.uk
Remove the NOJUNK to use.
 
Thank you for your quick replys.......

my syntax was "=[ssnFromPassword]![Social Security]"
where the query = ssnFromPassword
and the field = Social Security

I got this by using the "code builder" from the properties section of the text box.

I am building a data base tracking student input on each individual class. I am using 2 key fields in the table ... 1 is the [date], and 2 is the [ssn]..... this would allow all student to enter information on each [date] and only allow each student to do one form, but enter information in all [dates].

To get to this form, the student will have to use a [username] and a [password] in the "password" form.

The query uses the [password] to identify the SSn# and I would like the SSn# to be automatically entered on the form. This would make data entry faster and would cut down on mistakes......

once again, thanks for your intrest and help.......

I thank all of you. What you do for others is very special. What you are is special.

Shawn
 
You can set the default to:
=DLookup("[Social Security]","ssnFromPassWord")

Duane MS Access MVP
[green]Ask a great question, get a great answer.[/green] [red]Ask a vague question, get a vague answer.[/red]
[green]Find out how to get great answers faq219-2884.[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top