Error 13 - Type mismatch - on simple text box??

rudeboymcc

Registered User.
Local time
Today, 13:32
Joined
Sep 9, 2008
Messages
69
Hi. I have a form with a box on it that points to a currency field "Rent" on a table.

In VBA, i need to use this value to find the Rent per day (the user enters rent per month in the form).

at the moment i have:

Code:
Dim RentPerDay As Double
MsgBox Me.Rent
RentPerDay = Me.Rent * 12 / 365
MsgBox "Calculated Rent"
MsgBox "Rent per day " + RentPerDay

The first message box appears with the correct value i entered in the form, the second message to say it's calculated appears fine, and then the third message produces the error:
An unexpectd error has occurred,
error number: 13
description: Type Mismatch error

i've tried setting rentperday As Currency. The wierdest thing is this used to work perfectly. i don't know if an acccess update has broken it? I have tried making a new textbox that is not bound to anything in the tables, and still has teh same error.

Anyone have any ideas on what i can try?
 
With
MsgBox "Rent per day " + RentPerDay

You are trying to add RentPerDay to "Rent per day "

try
MsgBox "Rent per day " & RentPerDay

To concatenate the values into a string.

Regards,
Chris.
 
don't know why it worked before but it looks like you're adding a string and a number.
try
MsgBox "Rent per day " & RentPerDay

(i know '+' has its uses but give that a go).


edit: ... too sloooow
 
You spent too much time turning & red. :D
 
hey! what does this do? :D
 
ah - thanks guys. I was trying to debug the code that's why i added the message boxes. didn't think it would be the message boxes causeing the error!
 

Users who are viewing this thread

Back
Top Bottom