yan19454 Posted October 10, 2003 Posted October 10, 2003 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() Quote
*Experts* Volte Posted October 10, 2003 *Experts* Posted October 10, 2003 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. Quote
yan19454 Posted October 10, 2003 Author Posted October 10, 2003 you mean I need to loop through all the record in the table. Thanks for the quick response. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.