Decimal problem

G

Guest

Good Morning,
I am having problem with the field Previous Balance once I
have press SAVE and the Temp Balance is transfer to the
new record under Previous Balance, the number is rounding
up. Because this form is a budget form, I cannot have it
round up. Would it be "Dim INIFileNum As Integer" the
problem?

Can someone help me with this?

Here's the code that I am using. What is wrong with it?

TPrivate Sub Save_Click()
On Error GoTo Err_Save_Click

Dim INIFileNum As Integer


[temp balance] = [Previous Balance] - [Grand Balance]
INIFileNum = [temp balance]
DoCmd.GoToRecord , , acNext
[Previous Balance] = [INIFileNum]


' DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord, , acMenuVer70

Exit_Save_Click:
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click

End Sub

Thank you

Michelle
 
F

fredg

Good Morning,
I am having problem with the field Previous Balance once I
have press SAVE and the Temp Balance is transfer to the
new record under Previous Balance, the number is rounding
up. Because this form is a budget form, I cannot have it
round up. Would it be "Dim INIFileNum As Integer" the
problem?

Can someone help me with this?

Here's the code that I am using. What is wrong with it?

TPrivate Sub Save_Click()
On Error GoTo Err_Save_Click

Dim INIFileNum As Integer

[temp balance] = [Previous Balance] - [Grand Balance]
INIFileNum = [temp balance]
DoCmd.GoToRecord , , acNext
[Previous Balance] = [INIFileNum]

' DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord, , acMenuVer70

Exit_Save_Click:
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click

End Sub

Thank you

Michelle

Yes, if the value contains decimals.
An integer, by definition, is a whole number.
Change your variable to currency.

Dim INIFileNum As Currency
 
C

Cheryl Fischer

Michelle,
Would it be "Dim INIFileNum As Integer" the
problem?

Very likely. Integer and Long Integer data types cannot store decimal
values and so will round. Try using Double or Single as the data type.

hth,
--

Cheryl Fischer, MVP Microsoft Access



Good Morning,
I am having problem with the field Previous Balance once I
have press SAVE and the Temp Balance is transfer to the
new record under Previous Balance, the number is rounding
up. Because this form is a budget form, I cannot have it
round up. Would it be "Dim INIFileNum As Integer" the
problem?

Can someone help me with this?

Here's the code that I am using. What is wrong with it?

TPrivate Sub Save_Click()
On Error GoTo Err_Save_Click

Dim INIFileNum As Integer


[temp balance] = [Previous Balance] - [Grand Balance]
INIFileNum = [temp balance]
DoCmd.GoToRecord , , acNext
[Previous Balance] = [INIFileNum]


' DoCmd.DoMenuItem acFormBar, acRecordsMenu,
acSaveRecord, , acMenuVer70

Exit_Save_Click:
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click

End Sub

Thank you

Michelle
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top