Page 1 of 2 12 LastLast
Results 1 to 15 of 24
  1. #1
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21

    Formating a texbox


    I have a texbox on the form that is connected to query. It pulls number of years the client has been with the company. I want the number have only one decimal (i.e. 25.5) istead I get 25.4486767344. I have tryied set decimals in the query. I have tried to set texbox formating to show only one decimal. Nothing works. Does anyone know how to fix this?

  2. #2
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Formatting the text box for one decimal should work, unless your number is really not a number, but rather text.
    Just be sure to enter something in both the "Format" property and the "Decimal Places" property (i.e. "Fixed", "1").

    Where exactly does this number come from?
    Does the query calculate it, or pull it from a table?
    If it is calculated, what is the exact formula being used?
    If it is coming from a table, what is the field's Data Type in that table?

  3. #3
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21
    I the set textbox format to General Number and Decimal Places to 1. Query pulls this data from the table where the number is fixed and has Number data type 0.0.

    Before that I have used a query that had this field calculated and I couldn't change its fomating also. So, I connected the textbox to a new query where where the field is fixed. I deleted the old query. Maybe it is still somehow connected to this old query? But I don't see any connections?

  4. #4
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Maybe you have some old properties messing with it. Try deleting the Text Box, and then going to your list of available field, and re-drag that field out there to create a new Text Box. Then try applying the Formatting to this new Text Box and see if that works.

    BTW, I think you have a typo. "0.0" is not a valid Data Type. Where exactly have you typed in "0.0" on your Table field? Which Property?

  5. #5
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21
    I have tried deleting the textbox already. The textbox is controled by the combobox. When the client ID is entered in the combobox the text box displays the number of years. I have only query, the one that displays the fixed numer. Not sure where this texbox is pulling this number...

    I does say 0.0 for the data tape in the format property of the table. I didn't set it. It was set when the table was imported.

  6. #6
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I does say 0.0 for the data tape in the format property of the table. I didn't set it. It was set when the table was imported.
    I think you are getting confused. "Data Type" is not a Property. Look at this link here: http://office.microsoft.com/en-us/ac...010233292.aspx
    Circled item #1 show you where you see the "Data Type".

    Regarding the properties, here are the pertinent ones in this case:
    Format
    Decimal Places
    Input Mask
    Default Value

    So, can let us what the "Data Type" and those 4 properties are?

    I have tried deleting the textbox already. The textbox is controled by the combobox. When the client ID is entered in the combobox the text box displays the number of years. I have only query, the one that displays the fixed numer. Not sure where this texbox is pulling this number...
    I am guessing there is some VBA code attached to the ComboBox that is setting its value. Take a look at the "AfterUpdate" event of your ComboBox, and paste the VBA code of that here (or any other VBA code associated with the Combo Box).

  7. #7
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    FWIW here is an example you can place in the textbox format properties. Ignore the pulldown option and paste

    #,##0.0

    This will display 0.0 in a null or 0 value

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Here is an example in VBA. It takes a value from a field named Number and transfers it to an unbound textbox named txtResult

    Dim dblValue As Double
    dblValue = Me.Number
    dblValue = Format(dblValue, "#,##0.0")
    Me.txtResult = dblValue

  9. #9
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21
    Sorry, that it took me long to respond. Here are the 4 properties:

    Format: 0.0
    Decimal Places: Auto
    Input Mask: blank
    Default Value: blank

    I have tried to change decimal places propert to from auto to 1, but it doesn't change.

  10. #10
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21
    Here is my VBA Code for this form and the combo box:

    Private Sub ClientID_Change()
    Me.ClientName = Me.ClientID.Column(1)
    Me.Qtr = Me.ClientID.Column(8)
    Me.NAICS = Me.ClientID.Column(5)
    Me.TermDate = Me.ClientID.Column(3)
    Me.InitiatedTerm = Me.ClientID.Column(9)
    Me.StartDate = Me.ClientID.Column(2)
    Me.ProductLine = Me.ClientID.Column(7)
    Me.ClientState = Me.ClientID.Column(6)
    Me.ClientRegion = Me.ClientID.Column(4)
    Me.NAICSTitle = Me.ClientID.Column(23)
    Me.Tenure = Me.ClientID.Column(10)
    Me.BenefitsStartDate = Me.ClientID.Column(20)
    Me.RateCap = Me.ClientID.Column(21)
    Me.RateCapEffDate = Me.ClientID.Column(22)
    Me.Participation = Me.ClientID.Column(18)
    Me.CobraParticipation = Me.ClientID.Column(19)
    Me.WSE = Me.ClientID.Column(11)
    Me.Eligible = Me.ClientID.Column(17)
    Me.RegEE = Me.ClientID.Column(13)
    Me.CobraEE = Me.ClientID.Column(14)
    Me.TotalEnrolled = Me.ClientID.Column(12)
    End Sub

    Private Sub RunReport_Click()
    DoCmd.OpenReport "Client's Bio", acViewPreview, , "client_no ='" & Me.ClientID & "'"
    End Sub

  11. #11
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21
    I have tried copy & paste #,##0.0 into texbox format properties and query format properties. It didn't wok.

  12. #12
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I think we might need to see a copy of your database to see what is going on.
    Can you upload a "sanitized" version (removing any sensitive data)?
    I won't be able to look at it until tonight (I cannot download files from my current location), but someone else may be able to look at it in the meantime.

  13. #13
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21

    Database

    I tried to attached the database but it didn't upload. Its about 34,000kb zipped. What's the size limit on the attachments here?

  14. #14
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I don't know what the size limit is.
    If you have a ton of data, I would recommend deleted most of it, leaving just enough for us to see the issue.
    Also, be sure to compact the database after deleting the data to reduce the database size.
    Then zip and try uploading it.

  15. #15
    alextol is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2013
    Posts
    21
    Attached is the database. Enter Client ID's 001, 33M, CW1, D03 to test the form. Thanks for the help!

    Compact and Repair helped. The size limit is 500 KB.
    Attached Files Attached Files

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 3
    Last Post: 08-28-2013, 11:08 PM
  2. Combobox with texbox as criteria
    By putte11 in forum Forms
    Replies: 5
    Last Post: 12-10-2012, 05:32 PM
  3. formating issues
    By slimjen in forum Queries
    Replies: 4
    Last Post: 07-25-2012, 01:06 PM
  4. Conditional Formating
    By redbull in forum Reports
    Replies: 2
    Last Post: 03-26-2012, 12:08 PM
  5. click label -> append text to texbox
    By cnstarz in forum Access
    Replies: 5
    Last Post: 06-15-2011, 06:09 AM

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