due to local settings in Norway (Use of "," instead of "." as decimal sign.) Access gives me an error: Run-time error '3144' I did change the vba as listed below. Dim s1 as string S1 = FindBetween(S, """EUR"":", "}") ' should be 1 S1 = Replace(S1, ".", ",") EURrate = CDbl(S1) Status "Eur :" & S1 S1 = FindBetween(S, """USD"":", ",") S1 = Replace(S1, ".", ",") USDrate = CDbl(S1) Status "USD :" & S1 S1 = FindBetween(S, """GBP"":", ",") S1 = Replace(S1, ".", ",") GBPrate = CDbl(S1) Status "GBP :" & S1 S1 = FindBetween(S, """NOK"":", ",") S1 = Replace(S1, ".", ",") NOKrate = CDbl(S1) Status "NOK :" & S1
' check the Euro rate - should be 1 If EURrate <> 1 Then MsgBox "ERROR: Euro should be 1": Exit Sub
' set rest of the rates IN NOK EURrate2 = NOKrate / EURrate USDrate2 = NOKrate / USDrate GBPrate2 = NOKrate / GBPrate NOKrate2 = NOKrate / NOKrate ' should always be 1
' check the NOKrate2 - should be 1 If NOKrate2 <> 1 Then MsgBox "ERROR: NOK should be 1": Exit Sub
' set values in table
* CurrentDb.Execute "UPDATE ValutaT SET ValutaKurs=" & EURrate2 & " WHERE ValutaKode=""EUR""" CurrentDb.Execute "UPDATE ValutaT SET ValutaKurs=" & USDrate2 & " WHERE ValutaKode=""USD""" CurrentDb.Execute "UPDATE ValutaT SET ValutaKurs=" & GBPrate2 & " WHERE ValutaKode=""GBP""" ValutaListeBoks.RowSource = "SELECT ValutaID, Valutatekst, ValutaTegn, ValutaKurs, ValutaDato FROM ValutaT ORDER BY ValutaID" Status "Rates updated." & vbNewLine & "EUR:" & EURrate2 & vbNewLine & "USD:" & USDrate2 & vbNewLine & "GBP:" & GBPrate2
* Results in : Run-time error '3144' Syntax error in UPDATE-sentsentence
Sami Shamma
@Reply 2 years ago
The problem could be that the comma is reserved by VBA for its own use. Try the code with another character just to eliminate this possibility.
Sami Shamma
@Reply 2 years ago
This next video may give you hints on how to deal with this issue.
If you are a Visitor, go ahead and post your reply as a
new comment, and we'll move it here for you
once it's approved. Be sure to use the same name and email address.
This thread is now CLOSED. If you wish to comment, start a NEW discussion in
Access Developer 32.