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

Generating Fields

P: 6
Dear Friends

I want to creat more than one field in table on one event.
example:

staring mobile no: 07783457001
end mobile no: 07783457050

if enter starting and end mobile numbers in text box and click save button. database shuld create fields between 07783457001 and 07783457050 and save mobile numbers in table field. pls help how can I program this in MS Access or MS SQL.

Note: 07783457001 increment to 07783457050

Thanks
Sep 1 '07 #1
Share this Question
Share on Google+
10 Replies


missinglinq
Expert 2.5K+
P: 3,532
Are these "numbers" always going to start with a zero?

Welcome to TheScripts!

Linq ;0)>
Sep 1 '07 #2

P: 6
Are these "numbers" always going to start with a zero?

Welcome to TheScripts!

Linq ;0)>
No it can start with 2nd digit
Sep 2 '07 #3

FishVal
Expert 2.5K+
P: 2,653
No it can start with 2nd digit
Hi, MRuzly.

2 additional questions.
  • is this a telephone number with 11-digits always ?
  • what type of the table field where you store this numbers? I guess it is (or at least should be) Text type, but I want you to clarify this important detail.

Regards,

Fish
Sep 2 '07 #4

missinglinq
Expert 2.5K+
P: 3,532
With fields called StartMN and EndMN and a command button called GenerateMobileNumbers, this code will generate the required records with mobile numbers filled out to 11 digits. If you need something else let us know!
Expand|Select|Wrap|Line Numbers
  1. Private Sub GenerateMobileNumbers_Click()
  2. Dim mn As Long
  3. Dim Rec As Double
  4. Rec = (EndMN - StartMN) + 1
  5.  
  6. For mn = 1 To CInt(Rec)
  7.  DoCmd.GoToRecord , , acNewRec
  8.  Me.MobileNumber = Format(mn + (StartMN - 1), "00000000000")
  9. Next mn
  10. End Sub
  11.  
Linq ;0)>
Sep 2 '07 #5

missinglinq
Expert 2.5K+
P: 3,532
Your duplicate posting of this question/problem has been deleted! Please refrain from this prohibited behavior in the future! Your original post was responded to in approximately two hours!

From FAQs

Do Not Double Post Your Questions

Double posting is where you start a thread on a topic and then for some reason start another thread on exactly the same topic in the same forum. Please do not do this because

1. It makes it very hard for people to answer you especially if there are answers happening in all the threads you have started because they have to read 2 or more threads in order to see what has already been said.
2. It swamps the forum with your problem resulting in less attention for the other threads.

If you feel for some reason that you post has been overlooked (for instance it hasn't had any replies) please do not repost the question. Post a message to the thread you started, this will bump it back to the top of the thread list for the forum.


Thank you for your attention in this matter.


Linq ;0)>
Sep 2 '07 #6

P: 6
Hi, MRuzly.

2 additional questions.
  • is this a telephone number with 11-digits always ?
  • what type of the table field where you store this numbers? I guess it is (or at least should be) Text type, but I want you to clarify this important detail.

Regards,

Fish
- yes, the telephone number with 11-digits oftern
- Numeric Type Field
Sep 2 '07 #7

missinglinq
Expert 2.5K+
P: 3,532
The code I posted should work fine then!

Good Luck!

Linq ;0)>
Sep 2 '07 #8

P: 6
The code I posted should work fine then!

Good Luck!

Linq ;0)>
When I compile the code following Error msg displaying

Method or Data Member not found!


and highligting following line in code.

Me.MobileNumber = Format(mn + (StartMN - 1), "00000000000")

please help me to void this Error
Sep 2 '07 #9

missinglinq
Expert 2.5K+
P: 3,532
My guess would be that you need to replace MobileNumber with the actual name of the field on your form that holds the mobile number! When people post code here, they have to make up control names in order to display the code. You have to replace the names of controls in the code with your actual control names.

Linq ;0)>
Sep 2 '07 #10

P: 6
My guess would be that you need to replace MobileNumber with the actual name of the field on your form that holds the mobile number! When people post code here, they have to make up control names in order to display the code. You have to replace the names of controls in the code with your actual control names.

Linq ;0)>
I kindly thank you for your help. the program is working successfully

Good Luck!
Sep 3 '07 #11

Post your reply

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