By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,358 Members | 2,811 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,358 IT Pros & Developers. It's quick & easy.

Assign unbound Controls to Table Coulmns

P: n/a
Using VBA how do I assign columns from a table to controls on an unbound
form?

Mike
Jan 15 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
I do this all the time....

Just go:

me.MyContorlName.ControlSource = "Company"

The above text box control on the form will now display the company name of
the underlying recordset....

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Jan 15 '07 #2

P: n/a
SBC News Groups wrote:
Using VBA how do I assign columns from a table to controls on an unbound
form?
Answered you in your original thread...

--
Tim http://www.ucs.mun.ca/~tmarshal/
^o<
/#) "Burp-beep, burp-beep, burp-beep?" - Quaker Jake
/^^ "Be Careful, Big Bird!" - Ditto "TIM-MAY!!" - Me
Jan 15 '07 #3

P: n/a
"Albert D. Kallal" wrote
I do this all the time....

Just go:

me.MyContorlName.ControlSource = "Company"

The above text box control on the form will now
display the company name of the underlying recordset....
For this to work, don't you need to set the RecordSource of the Form before
setting the Control Source of the Control? The original post asked about
unbound Forms.

And, perhaps, the question really dealt with using unbound Forms without
binding them. In that case, you Open a Recordset on the data (Table or
Query), read the data using VBA code, set the values into the unbound
Controls, allow the user to update, and when the user takes whatever action
you've chosen to indicate "done", obtain the values, and use VBA code to
rewrite the data to the Recordset.

I've modified some other people's code that used unbound Forms and Controls,
as requested by clients, but not since I grokked "The Access Way" have I
created an unbound Form for handling data... for selecting information for
display or reporting, or for application navigation, yes; but for
data-handling, no.

Larry Linson
Microsoft Access MVP
Jan 15 '07 #4

P: n/a
For this to work, don't you need to set the RecordSource of the Form
before setting the Control Source of the Control? The original post asked
about unbound Forms.
Actually, you can set the contorlsource setting BEFORE you set the forms
reocordsouce (it does not generate an error..but, if you set contorlsouce of
a text
box BEFORE the forms reocrdsouce..you likely to see the familiar

#name?

appear in the text box.

So, in sense, it certainly not much use to set a textbox control source
UNTIL you set the forms data source.

So, in a sense, you are 100% right that it don't make any sense to bind a
text box until the form is bound!
(however, you *can* do this...and ms-access will not stop you except for the
"#name?" appearing).

On issues like this I likely would have been better to not mention that you
*can* do this!

And, perhaps, the question really dealt with using unbound Forms without
binding them.
Yes, that was my thought also. However, then I no sure how "binding"
would occur. I just assumed a bound form (either always, or at runtime),
and THEN the question becomes setting the contorlsource for a text box.

When I say I do this "all the time", I was actually referring to the
un-bound text box, but
the form at that point is a bound form. And, we certainly not talking about
creating controls at
runtime.

For my data update forms, they all tend to be bound..and that is simply the
access way...

If the day comes when I start promoting and writing lots of un-bound forms,
that
likely is the day I not going to be using ms-access anymore!!!
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl*****************@msn.com
Jan 15 '07 #5

P: n/a
"Albert D. Kallal" wrote
If the day comes when I start promoting and writing
lots of un-bound forms, that likely is the day I not
going to be using ms-access anymore!!!
No, Albert... DON'T DRINK THE KOOL-AID!

We enjoy having you in the Access camp 'way too much for you to pick a new
development tool!

Larry Linson
Jan 15 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.