Generating Fields

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • MRuzly
    New Member
    • Sep 2007
    • 6

    Generating Fields

    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
  • missinglinq
    Recognized Expert Specialist
    • Nov 2006
    • 3533

    #2
    Are these "numbers" always going to start with a zero?

    Welcome to TheScripts!

    Linq ;0)>

    Comment

    • MRuzly
      New Member
      • Sep 2007
      • 6

      #3
      Originally posted by missinglinq
      Are these "numbers" always going to start with a zero?

      Welcome to TheScripts!

      Linq ;0)>
      No it can start with 2nd digit

      Comment

      • FishVal
        Recognized Expert Specialist
        • Jun 2007
        • 2656

        #4
        Originally posted by MRuzly
        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

        Comment

        • missinglinq
          Recognized Expert Specialist
          • Nov 2006
          • 3533

          #5
          With fields called StartMN and EndMN and a command button called GenerateMobileN umbers, this code will generate the required records with mobile numbers filled out to 11 digits. If you need something else let us know!
          [CODE=vb]Private Sub GenerateMobileN umbers_Click()
          Dim mn As Long
          Dim Rec As Double
          Rec = (EndMN - StartMN) + 1

          For mn = 1 To CInt(Rec)
          DoCmd.GoToRecor d , , acNewRec
          Me.MobileNumber = Format(mn + (StartMN - 1), "0000000000 0")
          Next mn
          End Sub
          [/CODE]

          Linq ;0)>

          Comment

          • missinglinq
            Recognized Expert Specialist
            • Nov 2006
            • 3533

            #6
            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)>

            Comment

            • MRuzly
              New Member
              • Sep 2007
              • 6

              #7
              Originally posted by FishVal
              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

              Comment

              • missinglinq
                Recognized Expert Specialist
                • Nov 2006
                • 3533

                #8
                The code I posted should work fine then!

                Good Luck!

                Linq ;0)>

                Comment

                • MRuzly
                  New Member
                  • Sep 2007
                  • 6

                  #9
                  Originally posted by missinglinq
                  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), "0000000000 0")

                  please help me to void this Error

                  Comment

                  • missinglinq
                    Recognized Expert Specialist
                    • Nov 2006
                    • 3533

                    #10
                    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)>

                    Comment

                    • MRuzly
                      New Member
                      • Sep 2007
                      • 6

                      #11
                      Originally posted by missinglinq
                      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!

                      Comment

                      Working...