Kumba1
Technical User
- Aug 29, 2002
- 94
I'm trying to run the following code to determine if I have parts available on my Order Screen... so far when I try to do the SQL Portions I get a general message saying Syntax Error... But it's function is simple, run a query based on a text-string, and a qty, with some filtering parameters, and if there are no results, exit, if there are, display a message box that says parts are available...
Private Sub OP_AfterUpdate()
Dim y As String
Dim z As Integer
y = Me!StockNumber
z = Me!Qty
If IsNull(DoCmd.RunSQL "SELECT [tblPOParts].[StockNumber], [tblPOParts].[Stock], [tblPOParts].[Received], [tblPOParts].[BackOrder], [tblPOParts].Quantity FROM tblPOParts WHERE ((([tblPOParts].[StockNumber])="" & y & ""
And (([tblPOParts].[Stock])=-1) And (([tblPOParts].[Received])=0) And (([tblPOParts].[BackOrder])=0) And (([tblPOParts].Quantity)>" & z & "
);"
Then
Exit Sub
Else
MsgBox ("Parts are Available"
End Sub
Sorry abou the messy SQL Parts, but not sure where i'm messing up...
Private Sub OP_AfterUpdate()
Dim y As String
Dim z As Integer
y = Me!StockNumber
z = Me!Qty
If IsNull(DoCmd.RunSQL "SELECT [tblPOParts].[StockNumber], [tblPOParts].[Stock], [tblPOParts].[Received], [tblPOParts].[BackOrder], [tblPOParts].Quantity FROM tblPOParts WHERE ((([tblPOParts].[StockNumber])="" & y & ""
Exit Sub
Else
MsgBox ("Parts are Available"
End Sub
Sorry abou the messy SQL Parts, but not sure where i'm messing up...