JimbobGilb
Posts: 28
|
Posted: 02/22/2013, 6:45 PM |
|
My INSERT INTO code works but i only want to run it if Inventorylots1.Quantity.value > 0
I cannot get an if statement to work.
eg: if Inventorylots1.Quantity.value > 0 then
Dim SQL
Dim Connection
Dim ErrorMessage
Set Connection = New clsDBConnection1
Connection.Open
SQL = "INSERT INTO InventoryLots2 (PartNumber) "&_
"VALUES ("& DBConnection1.ToSQL(inventorylots1.PartNumber.value,ccsText) &")"
Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
Hopefully someone could give me some assistance.
Thanks,
|
|
|
Dorin
Posts: 50
|
Posted: 03/06/2013, 10:20 AM |
|
Hello,
If you are trying to update a second table, you can use the After Insert event with your code.
Something like this:
If Inventorylots1.Quantity.value > 0 then
Dim SQL
Dim Connection
Dim ErrorMessage
Set Connection = New clsDBConnection1
Connection.Open
SQL = "INSERT INTO InventoryLots2 (PartNumber) "&_
"VALUES ("& DBConnection1.ToSQL(inventorylots1.PartNumber.value,ccsText) &")"
Connection.Execute(SQL)
ErrorMessage = CCProcessError(Connection)
Connection.Close
Set Connection = Nothing
On Error Goto 0
End if
|
|
|
|