P
Pringle9984
I'm currently working on the stock control side of a database, at th
moment I'm writing the code for transfer stock from one location t
another, it basically works something like this
DIM blah blah blah..
LocationFrom = Me.frombo
LocationTo = Me.tobo
Material = Me.material_i
qty = Me.stock_qt
numRowsFrom = DCount("*"
"[sc_object]", "[location_id] =
& LocationFrom & " AND [material_id] =
& Material
If numRowsFrom = 0 The
reply = MsgBox("The from location has none of tha
material in stock.", vbOKOnly, "Error!"
En
End I
newQty1 = sc_object.object_qty - qt
'Build SQL statement to update existing record (with QTY
CurrentQuantity - NewQuantity
numRowsTo = DCount("*", "[sc_object]"
"[location_id] = " & LocationTo & " AN
[material_id] = " & Material
If numRowsTo = 0 The
'Build SQL statement to insert record (with QTY = 0
End I
'Build SQL statement to update existing record (with QTY
CurrentQuantity + NewQuantity
End Su
So... effectively the way this would work is
Does Stock Exist at 'From' location
No - Error, En
Yes - Update Stock at 'To' location (decrease Qty by X), Continu
Does Stock Exist at 'To' location
No - Insert Stock into 'To' location, Continu
Yes - Continu
Update Stock at 'To' location (increase Qty by X
The problem comes when I build the first SQL statement
[code:1:91a6f8cdb5]strSQL1 = "UPDATE [sc_object] SE
[object_qty] = " & sc_object.object_qty - qty
" WHERE ([location_id]=" & LocationFro
& ") AND ([material_id]="
Material & ");"[/code:1:91a6f8cdb5
More specifically the sc_object.object_qty - qty part which shoul
determine the new quantity
I get a 434 'Object Required' error which I assume is because i
doesn't know which record in 'sc_object' I'm refering to but can'
seem to resolve the problem
Any help would be hugely appreciated
Thanks in advance
moment I'm writing the code for transfer stock from one location t
another, it basically works something like this
DIM blah blah blah..
LocationFrom = Me.frombo
LocationTo = Me.tobo
Material = Me.material_i
qty = Me.stock_qt
numRowsFrom = DCount("*"
"[sc_object]", "[location_id] =
& LocationFrom & " AND [material_id] =
& Material
If numRowsFrom = 0 The
reply = MsgBox("The from location has none of tha
material in stock.", vbOKOnly, "Error!"
En
End I
newQty1 = sc_object.object_qty - qt
'Build SQL statement to update existing record (with QTY
CurrentQuantity - NewQuantity
numRowsTo = DCount("*", "[sc_object]"
"[location_id] = " & LocationTo & " AN
[material_id] = " & Material
If numRowsTo = 0 The
'Build SQL statement to insert record (with QTY = 0
End I
'Build SQL statement to update existing record (with QTY
CurrentQuantity + NewQuantity
End Su
So... effectively the way this would work is
Does Stock Exist at 'From' location
No - Error, En
Yes - Update Stock at 'To' location (decrease Qty by X), Continu
Does Stock Exist at 'To' location
No - Insert Stock into 'To' location, Continu
Yes - Continu
Update Stock at 'To' location (increase Qty by X
The problem comes when I build the first SQL statement
[code:1:91a6f8cdb5]strSQL1 = "UPDATE [sc_object] SE
[object_qty] = " & sc_object.object_qty - qty
" WHERE ([location_id]=" & LocationFro
& ") AND ([material_id]="
Material & ");"[/code:1:91a6f8cdb5
More specifically the sc_object.object_qty - qty part which shoul
determine the new quantity
I get a 434 'Object Required' error which I assume is because i
doesn't know which record in 'sc_object' I'm refering to but can'
seem to resolve the problem
Any help would be hugely appreciated
Thanks in advance