dbTalk Databases Forums  

Possible to tell what data type a control on a form contains?

comp.databases.ms-access comp.databases.ms-access


Discuss Possible to tell what data type a control on a form contains? in the comp.databases.ms-access forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
PW
 
Posts: n/a

Default Possible to tell what data type a control on a form contains? - 07-06-2011 , 04:22 PM






Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't see
how I can tell what the user entered so I can build a query string.

-paulw

Reply With Quote
  #2  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-06-2011 , 06:36 PM






PW wrote:
Quote:
Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't see
how I can tell what the user entered so I can build a query string.

-paulw
What the user entered is not really relevant. The datatypes of the database
fields are the determinging factor for the choice of delimiters you will use
for your query string. What you need to do is validate that what the user
entered in the textboxes is valid for the datatypes of the fields in which
you are planning to store the data or that you intend to use to filter the
results.

Are you planning to loop through the textboxes? Are they unbound? Perhaps
you can use the Tag property (does that still extist in whatever version of
Access you are using?) to store the name of the database field they apply to
if they are unbound.

Reply With Quote
  #3  
Old   
PW
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-06-2011 , 07:04 PM



On Wed, 6 Jul 2011 19:36:41 -0400, "Bob Barrows"
<reb01501 (AT) NOSPAMyahoo (DOT) com> wrote:

Quote:
PW wrote:
Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't see
how I can tell what the user entered so I can build a query string.

-paulw

What the user entered is not really relevant. The datatypes of the database
fields are the determinging factor for the choice of delimiters you will use
for your query string. What you need to do is validate that what the user
entered in the textboxes is valid for the datatypes of the fields in which
you are planning to store the data or that you intend to use to filter the
results.

Maybe I can write what the user selected to a table and then use the
type property.

Quote:
Are you planning to loop through the textboxes? Are they unbound? Perhaps
you can use the Tag property (does that still extist in whatever version of
Access you are using?) to store the name of the database field they apply to
if they are unbound.

2003. Is the tag property not available in 2010? If not, that might
totally screw up my approach as I plan on upgrading to it!

Unbound Bob. I got tired of Access automatically saving records (I
think that was it. And other stuff maybe). And from various tables.
They aren't all text boxes.

Thanks!

Reply With Quote
  #4  
Old   
Bob Barrows
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-06-2011 , 07:26 PM



PW wrote:
Quote:
On Wed, 6 Jul 2011 19:36:41 -0400, "Bob Barrows"
reb01501 (AT) NOSPAMyahoo (DOT) com> wrote:

PW wrote:
Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't
see how I can tell what the user entered so I can build a query
string.

-paulw

What the user entered is not really relevant. The datatypes of the
database fields are the determinging factor for the choice of
delimiters you will use for your query string. What you need to do
is validate that what the user entered in the textboxes is valid for
the datatypes of the fields in which you are planning to store the
data or that you intend to use to filter the results.


Maybe I can write what the user selected to a table and then use the
type property.

Are you planning to loop through the textboxes? Are they unbound?
Perhaps you can use the Tag property (does that still extist in
whatever version of Access you are using?) to store the name of the
database field they apply to if they are unbound.


2003. Is the tag property not available in 2010? If not, that might
totally screw up my approach as I plan on upgrading to it!
Don't know - sorry

Quote:
Unbound Bob. I got tired of Access automatically saving records (I
think that was it. And other stuff maybe). And from various tables.
They aren't all text boxes.

But your intent is to associate them with database fields, correct?Use the
control names to clue your code in, perhaps?

Reply With Quote
  #5  
Old   
Access Developer
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-06-2011 , 07:43 PM



Why the fixation on Controls in Forms -- they do not have a data type. If
they are bound Controls, that is, with a Control Source that is, or derives
from, a Field in a Table, that's where the data-type applies. And, that's
what determines the structure of any Query that uses the values from the
Form.

If the Control on the Form is displaying a Field that contains a date value,
SQL to use that date value in a Query would have to use paired #'s around
the content of the Field, because it's comparing against a date value, not
because of what the user typed into that Field on the Form.

And, if the Form is unbound, or a Control is unbound, you are doomed to
disappointment unless your users are far more consistent than most in typing
in values without any mistakes.

What are you trying to accomplish? We seem to have had a 'rash' of people
who 'want' Forms to store/define data, lately, and on that assumption, tell
us how they are trying to do something that does not work and want us to
help them correct it. We usually can, but only after asking the proper
questions and getting them answered.

--
Larry Linson, Microsoft Office Access MVP
Co-author: "Microsoft Access Small Business Solutions", published by Wiley
Access newsgroup support is alive and well in USENET
comp.databases.ms-access

"PW" <emailaddyinsig (AT) ifIremember (DOT) com> wrote

Quote:
On Wed, 6 Jul 2011 19:36:41 -0400, "Bob Barrows"
reb01501 (AT) NOSPAMyahoo (DOT) com> wrote:

PW wrote:
Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't see
how I can tell what the user entered so I can build a query string.

-paulw

What the user entered is not really relevant. The datatypes of the
database
fields are the determinging factor for the choice of delimiters you will
use
for your query string. What you need to do is validate that what the user
entered in the textboxes is valid for the datatypes of the fields in which
you are planning to store the data or that you intend to use to filter the
results.


Maybe I can write what the user selected to a table and then use the
type property.

Are you planning to loop through the textboxes? Are they unbound? Perhaps
you can use the Tag property (does that still extist in whatever version
of
Access you are using?) to store the name of the database field they apply
to
if they are unbound.


2003. Is the tag property not available in 2010? If not, that might
totally screw up my approach as I plan on upgrading to it!

Unbound Bob. I got tired of Access automatically saving records (I
think that was it. And other stuff maybe). And from various tables.
They aren't all text boxes.

Thanks!

Reply With Quote
  #6  
Old   
Stuart McCall
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-07-2011 , 03:02 AM



"PW" <emailaddyinsig (AT) ifIremember (DOT) com> wrote

Quote:
Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't see
how I can tell what the user entered so I can build a query string.

-paulw

Try this:

http://www.smccall.demon.co.uk/Forms.htm#CtlDataType

HTH

Reply With Quote
  #7  
Old   
PW
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-07-2011 , 11:51 AM



On Wed, 6 Jul 2011 19:43:42 -0500, "Access Developer"
<accdevel (AT) gmail (DOT) com> wrote:

Quote:
Why the fixation on Controls in Forms -- they do not have a data type. If
they are bound Controls, that is, with a Control Source that is, or derives
from, a Field in a Table, that's where the data-type applies. And, that's
what determines the structure of any Query that uses the values from the
Form.

If the Control on the Form is displaying a Field that contains a date value,
SQL to use that date value in a Query would have to use paired #'s around
the content of the Field, because it's comparing against a date value, not
because of what the user typed into that Field on the Form.

And, if the Form is unbound, or a Control is unbound, you are doomed to
disappointment unless your users are far more consistent than most in typing
in values without any mistakes.

What are you trying to accomplish?
I am trying to create an SQL Select string that is based upon what
combination of fields the user has selected. They can be combo boxes,
text boxes for dates, option boxes, check boxes, list boxes,... Some
of the combo boxes have a rowsource of a Select string. Some do come
from a field in a table. Some a value list. No fields have a control
source. Users can input dates in some textboxes, or numerics.

I will try a different approach. Thanks

Quote:
We seem to have had a 'rash' of people
who 'want' Forms to store/define data, lately, and on that assumption, tell
us how they are trying to do something that does not work and want us to
help them correct it. We usually can, but only after asking the proper
questions and getting them answered.

Reply With Quote
  #8  
Old   
PW
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-07-2011 , 11:53 AM



On Wed, 6 Jul 2011 20:26:06 -0400, "Bob Barrows"
<reb01501 (AT) NOSPAMyahoo (DOT) com> wrote:

Quote:
PW wrote:
On Wed, 6 Jul 2011 19:36:41 -0400, "Bob Barrows"
reb01501 (AT) NOSPAMyahoo (DOT) com> wrote:

PW wrote:
Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't
see how I can tell what the user entered so I can build a query
string.

-paulw

What the user entered is not really relevant. The datatypes of the
database fields are the determinging factor for the choice of
delimiters you will use for your query string. What you need to do
is validate that what the user entered in the textboxes is valid for
the datatypes of the fields in which you are planning to store the
data or that you intend to use to filter the results.


Maybe I can write what the user selected to a table and then use the
type property.

Are you planning to loop through the textboxes? Are they unbound?
Perhaps you can use the Tag property (does that still extist in
whatever version of Access you are using?) to store the name of the
database field they apply to if they are unbound.


2003. Is the tag property not available in 2010? If not, that might
totally screw up my approach as I plan on upgrading to it!

Don't know - sorry


Unbound Bob. I got tired of Access automatically saving records (I
think that was it. And other stuff maybe). And from various tables.
They aren't all text boxes.

But your intent is to associate them with database fields, correct?Use the
control names to clue your code in, perhaps?

I will hard-code the building of the SQL string using the name of the
control. I guess I was just trying to be flexible when changing the
form. Trying to be too slick!

Thanks

Reply With Quote
  #9  
Old   
PW
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-07-2011 , 11:55 AM



On Thu, 7 Jul 2011 09:02:57 +0100, "Stuart McCall"
<smccall (AT) myunrealbox (DOT) com> wrote:

Quote:
"PW" <emailaddyinsig (AT) ifIremember (DOT) com> wrote in message
news:vak917hpgid37jel4ph0danh6tpn3n87qe (AT) 4ax (DOT) com...
Hi,

I see Type won't work. On a form that has textboxes, comboboxes,
option groups, and the user can enter in dates, text, etc I don't see
how I can tell what the user entered so I can build a query string.

-paulw


Try this:

http://www.smccall.demon.co.uk/Forms.htm#CtlDataType

HTH


Some good things there! Thanks.

Reply With Quote
  #10  
Old   
PW
 
Posts: n/a

Default Re: Possible to tell what data type a control on a form contains? - 07-07-2011 , 12:14 PM



Quote:
2003. Is the tag property not available in 2010? If not, that might
totally screw up my approach as I plan on upgrading to it!

Don't know - sorry
Me neither. I have Access 2010 installed but I am reluctant to boot it
up again because I had a heck of a time trying to use 2003 again,
mostly due to reference problems.

-paulw

Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.