473,406 Members | 2,707 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Finding out a ListBox values data type

Hello all
I'm working on a database application with MS-Access 2007 and now i have a problem with dynamic report creation process!
I need to guess the data type of a ListBox! This my problem.
The ListBox fills dynamically from a selected field of a table(selected by the user).
I used VarType method to check the data type of a an item of that list box to determine the whole data type but it did not success.
Please help me to know how can i determine the data type of a ListBox or data type of a table's field.
More and More thanks
Jun 11 '10 #1

✓ answered by jimatqsi

alinagoo,
Here's how you can get the data type of a field returned, if you know the table name and field name:

Here's a sample ....
Expand|Select|Wrap|Line Numbers
  1.  
  2.    Dim db As Database, tbl As TableDef, fld As Field
  3.    Set db = CurrentDb
  4.     Dim strType As String
  5.     Dim intType As Integer
  6.  Set tbl = db.TableDefs("tbl_OEShipping")
  7.     Set fld = tbl.Fields("strOrderNumber")
  8.             Debug.Print fld.Name
  9.             strType = fld.Type
  10.             intType = fld.Type
  11. End Sub
There's an enumerated list somewhere telling what each value for fld.type means. But you can just run this code for one field of every type and then you can see for yourself what they mean.

2 3348
jimatqsi
1,271 Expert 1GB
alinagoo,
Here's how you can get the data type of a field returned, if you know the table name and field name:

Here's a sample ....
Expand|Select|Wrap|Line Numbers
  1.  
  2.    Dim db As Database, tbl As TableDef, fld As Field
  3.    Set db = CurrentDb
  4.     Dim strType As String
  5.     Dim intType As Integer
  6.  Set tbl = db.TableDefs("tbl_OEShipping")
  7.     Set fld = tbl.Fields("strOrderNumber")
  8.             Debug.Print fld.Name
  9.             strType = fld.Type
  10.             intType = fld.Type
  11. End Sub
There's an enumerated list somewhere telling what each value for fld.type means. But you can just run this code for one field of every type and then you can see for yourself what they mean.
Jun 11 '10 #2
@jimatqsi
Thanks you are right!
Good Luck :-bd
Jun 11 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: gaudetteje | last post by:
I just read in the 'What's New in Python 2.4' document that the None data type was converted to a constant: http://python.org/doc/2.4/whatsnew/node15.html """ # None is now a constant; code...
8
by: CAFxX | last post by:
i'm writing a program that executes some calculations on a bitmap loaded in memory. these calculation ends up with pixel wth values far over 255, but i need them to be between 0 and 255 since i...
13
by: dawatson833 | last post by:
I have several stored procedures with parameters that are defined with user defined data types. The time it takes to run the procedures can take 10 - 50 seconds depending on the procedure. If I...
2
by: Chicken Kebab Abdullah | last post by:
Does anyone know why I get the error 3464 Data type mismatch from the following code. I have a form with a combo(to choose a consumable) and 2 list boxes on it. list on left is all printers...
1
by: Mo | last post by:
The following select statement is givign me a 'data type mismatch' message and I don't really know why. strSQL = "SELECT CN" strSQL = strSQL & " FROM tblDeaths" strSQL = strSQL & " WHERE CN = ...
7
by: Arpan | last post by:
The .NET Framework 2.0 documentation states that An Object variable always holds a pointer to the data, never the data itself. Now w.r.t. the following ASP.NET code snippet, can someone please...
13
by: lane straatman | last post by:
I'm trying to figure out what data type is appropriate to represent a card in a game. The idea that I thought was going to work was a struct, foo, with two integer fields and two fields of char...
7
by: technocraze | last post by:
Hi guys, I encountered this error while using the AfterUpdate event for my listbox. Error: Update or CancelUpdate without using AddNew or Edit. What i wanted to achieve is just to display the...
2
by: psychomad | last post by:
Please, can someone help me out to solve this error, i've been searching throughout my codes and yet i didnt succeed in finding the error!!!! The Error is: Server Error in '/' Application....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.