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

Range of numbers for combo-box without using a table?

100+
P: 176
Hi.

I'm currently dealing with the following:

I need a drop box that will have in it a certain range of accending consuquential numbers for ex: 1, 2, 3, 4, 5, 6, 7. The min and the max number (the range) can be determined by user.

The only way I know of how to do it, is creating a VBA loop with the count of the range of numbers needed and appending each instance of the loop a record to a table, and in this way creating a table with sequentiqal numbers, then using the table as a row source of the query. Is there any other, simplier way?

Thanks in advance, Michael.
Mar 10 '07 #1
Share this Question
Share on Google+
4 Replies


Rabbit
Expert Mod 10K+
P: 12,347
A row source can be built using just the values:
Expand|Select|Wrap|Line Numbers
  1. "Value 1"; "Value 2"; "Value 3"
Mar 10 '07 #2

100+
P: 176
A row source can be built using just the values:
Expand|Select|Wrap|Line Numbers
  1. "Value 1"; "Value 2"; "Value 3"
Nope, doesn't work. It says values specified on this form does not exist.
Mar 10 '07 #3

MMcCarthy
Expert Mod 10K+
P: 14,534
Nope, doesn't work. It says values specified on this form does not exist.
You need to change the rowsourcetype to "Value List".

Mary
Mar 10 '07 #4

ADezii
Expert 5K+
P: 8,619
Hi.

I'm currently dealing with the following:

I need a drop box that will have in it a certain range of accending consuquential numbers for ex: 1, 2, 3, 4, 5, 6, 7. The min and the max number (the range) can be determined by user.

The only way I know of how to do it, is creating a VBA loop with the count of the range of numbers needed and appending each instance of the loop a record to a table, and in this way creating a table with sequentiqal numbers, then using the table as a row source of the query. Is there any other, simplier way?

Thanks in advance, Michael.
As long as you are not running an earlier Version of Access:
Expand|Select|Wrap|Line Numbers
  1. Dim lngMin As Long, lngMax As Long, intCounter As Integer
  2.  
  3. lngMin = 2000        'retrieve value in any manner
  4. lngMax = 2150        'retrieve value in any manner
  5.  
  6. Me![cboTest].RowSourceType = "Value List"
  7.  
  8. For intCounter = lngMin To lngMax
  9.   Me![cboTest].AddItem intCounter
  10. Next
Mar 11 '07 #5

Post your reply

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