record source

  • Thread starter enrico via AccessMonster.com
  • Start date
E

enrico via AccessMonster.com

how can you assign a value to a textbox from your sql query coded in VBA? i
tried it using VB.NET but i don't know if it'll work in access
 
A

Allen Browne

enrico via AccessMonster.com said:
how can you assign a value to a textbox from your sql query coded in VBA?
i tried it using VB.NET but i don't know if it'll work in access

If the text box is unbound (nothing in its Control Source), you can assign a
Value to it.

If you want the text box bound to a field, you can assign its ControlSource
property, typically in Form_Open. But there are some traps:
- Make sure the Name of the text box is not the same as the name of a field
if you assign it to anything else.

- Make sure the field doesn't disappear or change data type, as this may
bring Access down (closed by Windows.)
 
E

enrico via AccessMonster.com

yes, the textbox is unbound? i want my query result to be shown on the
textbox
 
A

Allen Browne

Use DLookup() the read the one field/row from the query, and assign to the
text box.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top