Multiplication doesnt work

voskouee

Registered User.
Local time
Today, 01:27
Joined
Jan 23, 2007
Messages
96
i have the following code

Sub CUR()

'Update Currency for RFG

Dim strsqlCURa As String
Dim strsqlCURb As String
Dim rsCur As DAO.Recordset
Dim rsRows As Variant

Set rsCur = CurrentDb.OpenRecordset("SELECT SOBP, CUR from CURRFG;")

Do While Not rsCur.EOF

DoCmd.SetWarnings (False)

strsqlCURa = "Update " & rsCur!SOBP & " set Debits = Debits * " & rsCur!CUR & ";"
strsqlCURb = "Update " & rsCur!SOBP & " set Credits = Credits * " & rsCur!CUR & ";"

DoCmd.RunSQL strsqlCURa
DoCmd.RunSQL strsqlCURb

DoCmd.SetWarnings (True)

rsCur.MoveNext

Loop

End Sub



Debits are Currency, Standard, 2
Credits are Currency, Standard, 2

Debits and Credist must be Currence for other calculations to work..


Cur of CurRFG table is NUmber, single, general, 6


the calculation cannot be done. any suggestions?
 
I think your recordset has the datasource locked up... You may need to use a temp table...
 
but it used to work before i changed the debits and credits to currency.. which i had to do..

is there a problem multiplying currency with numbers? i think something like that might be..

anyone had the same problem?
 
Maybe if you wrap the cur in a val() function?
 
strsqlCURa = "Update " & rsCur!SOBP & " set Debits = Debits * " & Val(rsCur!CUR) & ";"

???
 
thanks man.. it seems to work. i will check my multiplications to see if they are correct to the decimal..

thanks again
 

Users who are viewing this thread

Back
Top Bottom