Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Data type mismatch (numeric) 1

Status
Not open for further replies.

DPaul1994

Programmer
Mar 9, 2015
46
RO
I have a form with a textbox named Text1 and InputMask is set: 999.99
In free table, the column where I want to insert this value is numeric type with 2 decimals. But when I try to replace table_name.column with thisform.Text1.Value I receive: Data type mismatch. How can I solve this? Thanks.
 
Hi

All you need to do is pop a numeric value in the field (textbox) before you let the user do any data entry, so in the form's init
method do this:
Code:
thisform.text1.value = 0

Do that and VFP will treat the box as a numeric, stick a date in it and VFP will treat it as a date
Code:
thisform.text1.value = ctod("//")

One of the beauties of the VFP interface I think

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
Very nice, it worked, but if I introduce number "3.45", in table is shown only "3.4". Do you know why?
 
Hmm what maxlength do you have for the textbox?

It needs to be 6, not 5, as you count the decimal


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
It's set on 6, but InputMask is set on: 999.99
This should be the problem?
 
Set the text1.controlsource = 'table_name.column'
Don't do the REPLACE.

Bye, Olaf.
 
Not sure why that would be, unless the field in the table is defined as N(6,1)

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
If I do that, I receive: Object TEXT1 is not found.
In tabel is defined as N(3,2) :(
I just don't get it..
 
N(3,2) would be .99 no integer part
Should be N(6,2) for 999.99


Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.

I'm trying to cut down on the use of shrieks (exclamation marks), I'm told they are not good for you.
 
You can't simply execute text1.controlsrouce= 'something'.

In the form designer, click on the text1 textbox, open the properties window. In the data tab look out for the controlsource property and set it to tablename.column
Your text box now is bound to that table field.
That's all there is to read/write data access and control binding.

Bye, Olaf.
 
GriffMG thank you very much for you help, that was the solution! OlafDoschke thank you also for your help. I will try your solution too at least to see if I succeed in that way :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top