Decimal places will not display

C

CheyenneP

Hello:

I have VB code in Access that uses SQL string to "lookup" rates in a table.
The value that is returned in rs![Crew] is 12.33. I can see this when I put
a break in the code. But the value in [Forms]![frmHourlyEntry]!
[tblDatasubform]![Crew_Std] is 12 I need the 2 decimal places. I have
set all the formats in the table and forms to standard with 2 decimals places
but it doesn't work.

Here is the code. I tried the format statement that is commented out but it
gave me an object not found error.

Your help and time is appreciated.

Public Function GetStandards()
Dim db As Database
Dim rs As Recordset
Dim sSQL As String
sSQL = "SELECT * FROM tblStandardRates WHERE tblStandardRates.SAPItem = "
& "'" & [Forms]![frmHourlyEntry]![tblDatasubform]![Product] & "'" & ";"

Set db = CurrentDb
Set rs = db.OpenRecordset(sSQL, dbOpenDynaset)

If rs.RecordCount > 0 Then

'Format([Forms]![frmHourlyEntry]![tblDatasubform]![Crew_Std], "00.00")
= rs![Crew]
----MY PROBLEM IS IN THE STATEMENT BELOW
[Forms]![frmHourlyEntry]![tblDatasubform]![Crew_Std] = rs![Crew]
----MY PROBLEM IS IN THE STATEMENT ABOVE
 
R

Roger Carlson

What is the datatype of the field behind the [Crew_Std] control? If it is
Integer or Long, you will never see the decimal places.

BTW, using the Format() function will convert the number to a text string,
so that's probably not the best solution.
 
C

CheyenneP

You are so smart and I am so stupid ;) I had the datatype as long integer
even though I have the format as Fixed.

Thank you so much!

Roger said:
What is the datatype of the field behind the [Crew_Std] control? If it is
Integer or Long, you will never see the decimal places.

BTW, using the Format() function will convert the number to a text string,
so that's probably not the best solution.
[quoted text clipped - 33 lines]
[Forms]![frmHourlyEntry]![tblDatasubform]![Crew_Std] = rs![Crew]
----MY PROBLEM IS IN THE STATEMENT ABOVE
 

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

Top