473,385 Members | 1,856 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,385 software developers and data experts.

Combobox showing List of tables

Alireza355
Dear all,

I would like to know if there is a way to have a combobox in an unbound form to show only the names of tables starting with numbers. eg. 88 , 89, 90, etc.

Best Regards,
Alireza355
Mar 4 '09 #1
6 8180
PianoMan64
374 Expert 256MB
@Alireza355
Hey Alireza355,

Welcome.

Can you please post your code and show me what it is that you're speaking of. Since I dont' know how you're loading the Combo Box control, the answer is going to depend on the method used.

Thanks,

Joe P.
Mar 5 '09 #2
Dear PianoMan64,

I have created a database, with a lot of tables, forms and reports, etc. almost all the table names are not numberical. For example: Credit, Debit, Expenses, Codes, etc.

but some tables names are numerical. Example: 88, 89, 90, 91, etc.

I have an unbound form, asking the user to select one of the previous years, and the command button in that form does all the exchanges, table renames, calculations, updates, etc.

I just want the combobox in that form to show the names of tables which start with numbers.

Thanx a lot
Mar 5 '09 #3
DonRayner
489 Expert 256MB
This function will return a value list of tables that start with an integer. You can then use the forms "on open" or any other event to set the combobox.rowsource value.

Expand|Select|Wrap|Line Numbers
  1. Public Function ListTables()
  2.     Dim i As Integer
  3.     Dim s As String
  4.     On Error Resume Next
  5.     For i = 0 To CurrentDb.TableDefs.Count - 1
  6.         s = CurrentDb.TableDefs(i).Name
  7.         If Val(s) > 0 Then
  8.             If ListTables = "" Then
  9.                 ListTables = s
  10.             Else
  11.                 ListTables = ListTables & "; " & s
  12.             End If
  13.         End If
  14.     Next
  15. End Function
And the code for setting the rowsource would be.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Open(Cancel As Integer)
  2. ComboBoxName.RowSource = ListTables()
  3. End Sub
Mar 5 '09 #4
WOW!

You are a nuclear bomb........


Thanx a loooooooooooooooooooooooooooooooooooooooooot
Mar 7 '09 #5
DonRayner
489 Expert 256MB
You're quite welcome. Good luck with your project

Don
Mar 7 '09 #6
Dear Don,

First of all, I would like to thank you again for your kind help.

My accounting project is finally finished, and working perfectly. But there is one last thing I would like to have deep knowledge on, and since you are an expert, I would like to ask you to have a look at another thread I have started on March 7th, called "Lock Records", and see if you can provide help.

Thank you very much, and with all the best wishes.
Mar 8 '09 #7

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

Similar topics

2
by: Phil | last post by:
My form uses a dataset containing two tables, a base table (Contact) and a lookup table (Insurer). My combobox is bound as follows: DataSource = datasetContact DisplayMember =...
0
by: amber | last post by:
Hello, I'm using the following code to work with a combobox: combobox1.Datasource = employeeDataset.Table(0) combobox1.ValueMember = "STR_INITIALS" combobox1.DisplayMember = "BOTH_NAMES"...
0
by: Jesper Denmark | last post by:
Well I'm new to C# and I do not know of all of the different controls yet. The grid you are referring to is that the datagrid control, and if yes, would it be possible to use it without a database...
3
by: PeterZ | last post by:
G'day, After doing much searching and pinching bits of ideas from here there and everywhere I came up with a fairly 'clean' solution of including a comboBox into a dataGrid column. You can...
2
by: Anand | last post by:
Hi All, I have a combobox with style as DropDown List. When I set the combobox.selectedIndex = 0, the first value is not showing up in the combobox and it is simply blank. Only if I...
11
by: Bill nguyen | last post by:
Table A has 2 columns: recID int recName String I need to load all recName into combobox B using B.Items.Add(recName). This is no problem. However, I would like to be able to match ComboxBox...
5
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique...
1
by: fiaolle | last post by:
Hi The first set of source code is the class for a combobox in a grid, hopefully. In the second set of code we try to use the combobox class, but the grid is empty. I don't understand how this...
4
by: JJGarcia | last post by:
Hi Everyone, I'll try to explain the process I'm following, I'm new to this so I'm triying the easy way first, probably the lasyest too! I created a new Project, drag in to it a SQLConnection,...
2
by: gleadams | last post by:
I have databound a Windows form ComboBox control to a DataSource and DataMember and it is properly showing the data as I navigate through the records. My question concerns the choices in the...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.