TextBox Format

gray

Registered User.
Local time
Today, 14:35
Joined
Mar 19, 2007
Messages
578
Hi All

WinXpPro Sp2
Access 2007

I have a custom inputbox (unbound) which is intended for users to supply various data incl Text, Integers, Doubles and Dates.

In order to police the input, I format the textbox on-the-fly in VB according to the required data. This does not seem entirely reliable however?

As you will see from the attached, I am trying to input a double with 2 decimal places but it gets refused. I have a label on the box in which (for diagnostic purposes) I write the latest format applied to the box... in this case double and 2 dec places.

Any idea why it's getting refused?

Smetimes also, I write a number into the box and when the value from the box gets passed back to it's parent form the number gets converted to a date/time format.. Values are passed back to the parent form as type Variant.

Clearly, I'm missing something here?

Thanks
 

Attachments

  • format_v01.JPG
    format_v01.JPG
    53.5 KB · Views: 106
Last edited:
Hi

As you will see from the attached
I can not see any attachment.
If you are going to give us a db to examine, please convert it to A2003 mdb format.
 
Apologies... jpg now attached..
 
Hi gray

I format the textbox on-the-fly in VB according to the required data
Could it be that there is something wrong with this and that the required format is not actually being applied?

If you can catch where the error is occurring then maybe you could interrogate the the format property at that time and view the result with a msgbox or debug.print
 
Hi

I've edited the textbox label to show intended and actual format and decimals... please see attached.

Although the latter 'format' looks dodgy, i assume that's just the way Access stores it.

Incidentally, I set the format and decimals thus:-

Code:
Dim Format_Value As String
Dim Format_Decimals As String
 
Format_Value = "Double"
Format_Decimals = "2"
 
If Not IsNull(Format_Value) And Format_Value <> "" Then
            Me.txtInput_TextBox.Format = Format_Value
End If
 
If Not IsNull(Format_Decimals) Then
            Me.txtInput_TextBox.DecimalPlaces = Format_Decimals
End If

thanks
 

Attachments

  • format_v02.JPG
    format_v02.JPG
    50.9 KB · Views: 100
Hi

I pass the parms from a "parent" form to the inputbox-form via form-open-arguments and so the code to set the inputbox format resides in its form-open event.
 
Is it possible for you to post a cut down version of the db in A2003 mdb format with a little test data?
 
Sure.... it'll take a few mins to strip out ... I'll get back asap..... thanks
 
Hi Bob

Fed up with the d*mn thing :) ... so I think I've decided to use another approach... I'm just going to test isNumeric, IsDate etc when the user submits the value...

Thanks for the assistance.

Cheers
 
I know how you feel. I've been there too many times. ;)

But if you change your mind, just post back. :)
 

Users who are viewing this thread

Back
Top Bottom