Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I tried to format my labresult as one decimal format while labcode is CPK and MB in the table. But it keep giving me error

An unhandled exception of type 'System.Data.OleDb.OleDbException' occurred in system.data.dll

 

Dim strSQL As String

dim PTypeConnection As New OleDb.OleDbConnection()

dim PTypeCommand As New System.Data.OleDb.OleDbCommand()

strSQL = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Working Folder\debS\PTypeConvert\Ptype.mdb;"

PTypeConnection.ConnectionString = strSQL

PTypeConnection.Open()

PTypeCommand.CommandText = "UPDATE tblExportLab SET tblExportLab.LabResult = (Format([tblExportLab]![LabResult],'0.0')) " _

& "WHERE (tblExportLab.LabCode<>'CPK') Or (tblExportLab.LabCode<>'MB');"

PTypeCommand.ExecuteNonQuery()

  • *Experts*
Posted
I'm almost positive you can't just use inline VBScript in queries as you can from Access. You need to select the data you want to format from the database, format it yourself, and then update the record with that data.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...