Results 1 to 14 of 14
  1. #1
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60

    numeric field in table

    how to create field in table that just get number?

  2. #2
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Set the fields data type to Auto Number
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  3. #3
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by Bob Fitz View Post
    Set the fields data type to Auto Number
    I want to insert number not to create auto

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    You want to insert a number.
    When?
    How?
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Perhaps you could give us a bit more about what exactly you are trying to do.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  6. #6
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by Bob Fitz View Post
    Perhaps you could give us a bit more about what exactly you are trying to do.
    i have table, one of its filed is TelNO (maybe it has 5 or 6 digits or more without any restriction)
    now I want to insert only number in this field

  7. #7
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Try the following lines of code in the Before UpDate event of the text box in which the telephone number is entered.
    Code:
    If Not IsNumeric(Me.ActiveControl) Then
      Cancel = True
      MsgBox "Entry must be numeric"
    End If
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  8. #8
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by Bob Fitz View Post
    Try the following lines of code in the Before UpDate event of the text box in which the telephone number is entered.
    Code:
    If Not IsNumeric(Me.ActiveControl) Then
      Cancel = True
      MsgBox "Entry must be numeric"
    End If
    ITS NOT TEXT BOX it is table and TelNO is field in it

  9. #9
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    From experience, a TelNo ( I'm reading this as telephone number) is really a text/string field. You don't do any arithmetic operations on a telNo -- eg my telNo +6
    Whereas with an QuantityOnHand, you could do such arithmetic operations
    eg QuantityOnHand = QuantityOnHand - QuantitySold

    You can insert a string, and ensure that all characters are digits ( each char must be 0-9)

    Do you want to allow - or ( or ) ?

  10. #10
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    Quote Originally Posted by msasan1367 View Post
    ITS NOT TEXT BOX it is table and TelNO is field in it
    Well, IMHO, tables are for storing data. If you want to enter data to the table then you sould use a form that is bound to that table.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  11. #11
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows XP Access 2003
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,530
    You could set the Input Mask property for a field in a table, or for a text box on a form to #######
    However, this would restrict the max number of digits entered to however many #s you have set.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  12. #12
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    I agree with Bob -- data gets entered into the table via a Form. Users have access to Forms - not tables directly.

  13. #13
    msasan1367 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Feb 2013
    Posts
    60
    Quote Originally Posted by orange View Post
    From experience, a TelNo ( I'm reading this as telephone number) is really a text/string field. You don't do any arithmetic operations on a telNo -- eg my telNo +6
    Whereas with an QuantityOnHand, you could do such arithmetic operations
    eg QuantityOnHand = QuantityOnHand - QuantitySold

    You can insert a string, and ensure that all characters are digits ( each char must be 0-9)

    Do you want to allow - or ( or ) ?
    how to use QuantityOnHand? can you put sample

  14. #14
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,716
    What exactly are you having issues with?

    When you create a table (MyTable),:
    - you can name a field MyTelNo and assign it datatype Text.
    -you can name a field MyQuantity and assign it datatype Number Integer

    In a query you could enter some test data

    In an Update query you could say

    Update MyTable Set MyQuantity = MyQuantity + 100

    which will update all records, and will update the current MyQuantity value with MyQuantity + 100

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 09-25-2011, 08:52 AM
  2. check the format of an numeric inputted field?
    By eliotchs in forum Programming
    Replies: 1
    Last Post: 04-20-2011, 11:35 AM
  3. Justify numeric text field
    By tpcervelo in forum Queries
    Replies: 2
    Last Post: 01-27-2011, 03:50 PM
  4. Split Numeric Data out of Irregular Text Field
    By nathanielban in forum Queries
    Replies: 6
    Last Post: 12-21-2010, 10:30 AM
  5. Bring in numeric text field to access from excel
    By Sck in forum Import/Export Data
    Replies: 1
    Last Post: 12-13-2010, 04:07 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums