From-to function

  • Thread starter Thread starter BruceM
  • Start date Start date
B

BruceM

Base a form or report on a query. In query design view, put something like
this in the Criteria row for the SerialNumber field:
Between [Starting number] And [Ending number]
 
Hi all

We'r into telecom business and running MIS on MS-Access 2000.

We received around 100 prepaid cards bearing unique serial numbers viz.
28000011223 to 28000011226.

My problem is:

Is there any way so that if i enter the first serial number and last
serial number, i get the output as
2800011223
2800011224
2800011225
2800011226

plz. suggest.

Thanks and Regards

Deepak
Chandigarh, India.
 
You have the input with 4 zeros and the output with 3. Is that really what
you want?

otherwise your problem would seem to be simply solvable by entering these
numbers into a long integer field and running a query to select and sort
them. Or do I not understand the problem?
 
Actually,i've done it.

But i'm unable to enter data in it.
Can i be able to enter data using this like i said, if i enter 1 in
[starting number] and 5 in [ending number], do i get the output as 1, 2, 3,
4, 5.

BruceM said:
Base a form or report on a query. In query design view, put something
like this in the Criteria row for the SerialNumber field:
Between [Starting number] And [Ending number]

Deepak Verma said:
Hi all

We'r into telecom business and running MIS on MS-Access 2000.

We received around 100 prepaid cards bearing unique serial numbers viz.
28000011223 to 28000011226.

My problem is:

Is there any way so that if i enter the first serial number and last
serial number, i get the output as
2800011223
2800011224
2800011225
2800011226

plz. suggest.

Thanks and Regards

Deepak
Chandigarh, India.
 
Yes, if you enter 1 and 5, you should get the 5 rows you indicated (provided
they exist).

What do you mean that you're "unable to enter data in it"?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Deepak Verma said:
Actually,i've done it.

But i'm unable to enter data in it.
Can i be able to enter data using this like i said, if i enter 1 in
[starting number] and 5 in [ending number], do i get the output as 1, 2,
3, 4, 5.

BruceM said:
Base a form or report on a query. In query design view, put something
like this in the Criteria row for the SerialNumber field:
Between [Starting number] And [Ending number]

Deepak Verma said:
Hi all

We'r into telecom business and running MIS on MS-Access 2000.

We received around 100 prepaid cards bearing unique serial numbers viz.
28000011223 to 28000011226.

My problem is:

Is there any way so that if i enter the first serial number and last
serial number, i get the output as
2800011223
2800011224
2800011225
2800011226

plz. suggest.

Thanks and Regards

Deepak
Chandigarh, India.
 
I don't know what you mean by "unable to enter data in it." Do you mean you
are entering numbers but no records are returned? If you enter 1 and 5 as
[Starting number] and [Ending number] you will get all records that have a
value from 1 to 5 in that field.
If you want to use 1 and 5 as the start and end values, and see records with
numbers that end with digits between 1 and 5 (including both numbers), one
way is to create a calculated query field, something like:
LastDigit: Right([YourField],1)
Your could then use Between [Start] & [End] as the criteria for that field.

Deepak Verma said:
Actually,i've done it.

But i'm unable to enter data in it.
Can i be able to enter data using this like i said, if i enter 1 in
[starting number] and 5 in [ending number], do i get the output as 1, 2,
3, 4, 5.

BruceM said:
Base a form or report on a query. In query design view, put something
like this in the Criteria row for the SerialNumber field:
Between [Starting number] And [Ending number]

Deepak Verma said:
Hi all

We'r into telecom business and running MIS on MS-Access 2000.

We received around 100 prepaid cards bearing unique serial numbers viz.
28000011223 to 28000011226.

My problem is:

Is there any way so that if i enter the first serial number and last
serial number, i get the output as
2800011223
2800011224
2800011225
2800011226

plz. suggest.

Thanks and Regards

Deepak
Chandigarh, India.
 
That's not what you asked for in the first place (or at least it's not
obvious that that's what you meant: everyone's been given you answers on how
to retrieve the rows that have the numbers you're indicating, not how to
generate them.)

You'll need to use VBA. Here's one approach using DAO. It assumes that every
card in the batch is going to have the same value for Field1 (which it
assumes is numeric) and for Field2 (which it assumes is text), and that
those values are in text boxes txtField1 and txtField2 on the form :

Dim dbCurr As DAO.Database
Dim lngLoop As Long
Dim lngStart As Long
Dim lngStop As Long
Dim strSQL As String

lngStart = InputBox("Enter the starting number:")
lngStop = InputBox("Enter the stopping number:")

If lngStart < lngStop Then
Set dbCurr = CurrentDb()
For lngLoop = lngStart To lngStop
strSQL = "INSERT INTO MyTable (CardNumber, Field1, Field2) " & _
"VALUES(" & lngLoop & "," & txtField1 & ", '" & txtField2 & "')"
dbCurr.Execute strSQL, dbFailOnError
Next lngLoop
Set dbCurr = Nothing
End If

You'll need to add your own error checking to ensure that txtField1 and
txtField2 contain valid values.

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Deepak Verma said:
"Unable to enter data" means i'm unable to CREATE records (in the table
name "numbers") for serial numbers starting from [1] and ending on [5].

My problem is that i want to enter just first serial number and the last
serial number and i want the access-table to create records for the values
between these serial numbers.

Now, plz. suggest.


Douglas J. Steele said:
Yes, if you enter 1 and 5, you should get the 5 rows you indicated
(provided they exist).

What do you mean that you're "unable to enter data in it"?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Deepak Verma said:
Actually,i've done it.

But i'm unable to enter data in it.
Can i be able to enter data using this like i said, if i enter 1 in
[starting number] and 5 in [ending number], do i get the output as 1, 2,
3, 4, 5.

Base a form or report on a query. In query design view, put something
like this in the Criteria row for the SerialNumber field:
Between [Starting number] And [Ending number]

Hi all

We'r into telecom business and running MIS on MS-Access 2000.

We received around 100 prepaid cards bearing unique serial numbers
viz. 28000011223 to 28000011226.

My problem is:

Is there any way so that if i enter the first serial number and
last serial number, i get the output as
2800011223
2800011224
2800011225
2800011226

plz. suggest.

Thanks and Regards

Deepak
Chandigarh, India.
 
"Unable to enter data" means i'm unable to CREATE records (in the table name
"numbers") for serial numbers starting from [1] and ending on [5].

My problem is that i want to enter just first serial number and the last
serial number and i want the access-table to create records for the values
between these serial numbers.

Now, plz. suggest.


Douglas J. Steele said:
Yes, if you enter 1 and 5, you should get the 5 rows you indicated
(provided they exist).

What do you mean that you're "unable to enter data in it"?

--
Doug Steele, Microsoft Access MVP

(no private e-mails, please)


Deepak Verma said:
Actually,i've done it.

But i'm unable to enter data in it.
Can i be able to enter data using this like i said, if i enter 1 in
[starting number] and 5 in [ending number], do i get the output as 1, 2,
3, 4, 5.

BruceM said:
Base a form or report on a query. In query design view, put something
like this in the Criteria row for the SerialNumber field:
Between [Starting number] And [Ending number]

Hi all

We'r into telecom business and running MIS on MS-Access 2000.

We received around 100 prepaid cards bearing unique serial numbers viz.
28000011223 to 28000011226.

My problem is:

Is there any way so that if i enter the first serial number and last
serial number, i get the output as
2800011223
2800011224
2800011225
2800011226

plz. suggest.

Thanks and Regards

Deepak
Chandigarh, India.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top