Kelloggs
Active Member
   

Do crazy people know they are crazy?
Posts: 784
Gender:
|
Here is a good example. It is a MS Acces function, but the insert script is there 'INSERT QUANTITIES ON SHIPPING PSQL DATABASE sqlString = "INSERT INTO PS_SOL ( so_type, so_wopre, so_wosuf, so_line, dba_line1, dba_line2, partid, pdesc, shipper, qty, bo, shp, shp_date, shp_time, shp_status) VALUES ( 'WO', " & WOPRE & "," & WOSUF & ", " & SOLINE & ", '" & LN1 & "', '" & LN2 & "' ,'" & PCODE & "', '" & PDESC & "', '" & dhGetUserName() & "'," & QTY & "," & NBO & "," & TSHP & ", CURDATE ( ), CURTIME ( ), '" & SSta & "')" INSERT_SHP (sqlString) 'Do SO Status 'Find if SO is there already sqlString = "SELECT count(*) as Exs FROM PS_SO where so_wopre = " & WOPRE & " AND so_wosuf = " & WOSUF CurrentDb.QueryDefs("Server_PS_SO").SQL = sqlString If DLookup("[Exs]", "Server_PS_SO") = 0 Then If DLookup("[FSHP]", "Sys_SO_Status") = 0 Then SoStat = "Fully Shipped" Else SoStat = "Partially Shipped" End If sqlString = "INSERT INTO PS_SO ( so_wopre, so_wosuf, so_type, so_status, so_date, custid, customer, custorder, jobnum, so_desc ) VALUES ( " & WOPRE & "," & WOSUF & ", 'WO','" & SoStat & "', CURDATE(),'" & CUSCOD & "','" & CUSNME & "','" & CUSORD & "','" & JOBNUM & "','" & DESC & "')" INSERT_SHP (sqlString) Else If DLookup("[FSHP]", "Sys_SO_Status") = 0 Then SoStat = "Fully Shipped" Else SoStat = "Partially Shipped" End If sqlString = "Update PS_SO Set so_status = '" & SoStat & "', so_date = CURDATE() where so_wopre = " & WOPRE & " AND so_wosuf = " & WOSUF INSERT_SHP (sqlString) End If
|