Type Mismatch Error

conton

New Member
Joined
May 25, 2011
Messages
15
Hi there!

I get a the Type Mismatch runtime error when the following code runs in Access:

Code:
Me.Textbox1 = Me.Textbox2 * 136.4 - (Me.Textbox2 * 136.4 * Me.Textbox3)

The textboxes are formatted as follows:

Me.Textbox1 = Currency
Me.Textbox2 = General Number
Me.Textbox3 = Percent

So I assume the problem is that my equation is multiplying a general number with a percentage and Access isn't converting the percentage into number form (eg. 15% = 0.15).

Any ideas on how I can make this work?

Thanks in advance!
 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
Try this:
Code:
Me.Textbox1 = Ccur( Me.Textbox2 * 136.4 - (Me.Textbox2 * 136.4 * Me.Textbox3))
 
Last edited:
Upvote 0
Are these bound or unbound text boxes?
Where are you placing this code?
 
Upvote 0
Yeah, my bad, you grabbed it then I edited it. Go back and look at it now. :)

or, maybe you got the good code. But try the .value.
 
Upvote 0
I re-created the layout, and this code works for me:
Code:
Private Sub Form_Current()
    Me.TextBox1.Value = Me.Textbox2.Value * 136.4 - (Me.Textbox2.Value * 136.4 * Me.TextBox3.Value)
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top