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!

Assign Value To A Text Box On A Form - Help Appreciated! 1

Status
Not open for further replies.

SheetsERR

MIS
Nov 13, 2001
66
US
Hey, all!

I know it can be done, but how?

I'd like to pull values from a table to a textbox on a form. I use SQL SELECT statements with comboboxes all the time. There is no Row Source attribute for a textbox.

Thanks,
Sheetserr
 
You should be able to do the following

textbox = value
where value can be a dlookup from the table that stores the data or you can use a literal or the column(index) property . Place the express on the forms on current or if the value depends on data entered in another textbox place it on the OnExit event of that textbox.
 
Thanks! I'll give that a shot tonight, but I might be back with more questions. Hope you don't mind.

Sheetserr
 
Let me provide a little background.....

I have a form called frm_Month and a subform called subfrm_LateFee - linked on the column Month. There are two columns, FirstName and LastName, which do not reside in either one of the base tables that correspond to the two forms mentioned above.

Can I use a SQL query to pull those two columns out of tbl_Staff (the third, unrelated table) and concatenate them into an unbound textbox on the subform? I can write the SQL, but I don't have a clue how to implement it! I'm not a VBA whiz.

Your help is greatly appreciated, and maybe, it won't even require VBA coding! :)

Thanks,
Sheetserr
 
Icoble. . .

is this the same way I would fill a value of a textbox in a continuous subform?

I use a combobox to select the company on the main form, but want to fill all new records of the subform with the same company ID selected in the main form.

Thanks for any info you or others could give.
 
educate889,

My scenario is a bit different, but hopefully, the good folks here can help us both find an answer!

I'm trying to query data into a textbox from a table that is completely unrelated to the form and subform.

Sheetserr
 
One way to get the data into the textbox is to get it from another form object by referring to the object in the text box 'control source' field. I.e. '=[Forms]![frm_any-open-form]![cbo_any-combo-or-listbox]'

I use listboxes sometimes. A listbox looks like a textbox and can use SQL queries in the row source field.
 
Tjoh and Icoble,

Thanks for the helpful hints!

Sheetserr
 
Tjoh,

Do you know how to tie a textbox to a query? The info I'm trying to pull into the textbox is directly from a table. It's not from an open form. Unfortunately, the table is not bound to the form or subform in question.

Thanks!
Sheetserr
 
Can anyone weigh in on my last post? I really would like to understand this concept.

Thanks!
Sheetserr
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top