B
Bre-x
I have setup a function to query work orders
When the user enter a work order number the function get the info.
How can i modify it so that the user can enter 145*
so he gets 1451, 1452, etc, etc.
Regards,
Kelloggs
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
If IsNull(Me.TWO) = True Then
Responce = MsgBox("Enter a Work Order Number", vbCritical, " UMCI")
Me.TWO.SetFocus
Exit Sub
End If
sqlString = "SELECT count(*) as CC FROM WORKORD WHERE MTWO_WIP_WOPRE = " &
Me.TWO
CurrentDb.QueryDefs("DBA").SQL = sqlString
If DLookup("[CC]", "DBA") >= 1 Then
GetData (Me.TWO)
Else
Responce = MsgBox("Cant Find Work Order, try again", vbCritical, "
UMCI")
Me.TWO.SetFocus
Exit Sub
End If
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub
Function GetData(WO)
On Error GoTo GetData_Err
Dim sqlString As String
DoCmd.SetWarnings False
'WORKORD
sqlString = "SELECT MTWO_WIP_WOPRE, MTWO_WIP_WOSUF, MTWO_WIP_ATOTAL,
MTWO_WIP_CODE
FROM WORKORD where MTWO_WIP_WOPRE = " & WO
'do queries
CurrentDb.QueryDefs("DBA").SQL = sqlString
DoCmd.RunSQL "DELETE FROM Temp_WO;"
DoCmd.RunSQL "SELECT DBA.* INTO Temp_WO FROM DBA;"
'open form
DoCmd.OpenForm "Main"
DoCmd.Close acForm, "SW"
GetData_Exit:
Exit Function
GetData_Err:
MsgBox Error$
Resume GetData_Exit
End Function
When the user enter a work order number the function get the info.
How can i modify it so that the user can enter 145*
so he gets 1451, 1452, etc, etc.
Regards,
Kelloggs
Private Sub Command3_Click()
On Error GoTo Err_Command3_Click
If IsNull(Me.TWO) = True Then
Responce = MsgBox("Enter a Work Order Number", vbCritical, " UMCI")
Me.TWO.SetFocus
Exit Sub
End If
sqlString = "SELECT count(*) as CC FROM WORKORD WHERE MTWO_WIP_WOPRE = " &
Me.TWO
CurrentDb.QueryDefs("DBA").SQL = sqlString
If DLookup("[CC]", "DBA") >= 1 Then
GetData (Me.TWO)
Else
Responce = MsgBox("Cant Find Work Order, try again", vbCritical, "
UMCI")
Me.TWO.SetFocus
Exit Sub
End If
Exit_Command3_Click:
Exit Sub
Err_Command3_Click:
MsgBox Err.Description
Resume Exit_Command3_Click
End Sub
Function GetData(WO)
On Error GoTo GetData_Err
Dim sqlString As String
DoCmd.SetWarnings False
'WORKORD
sqlString = "SELECT MTWO_WIP_WOPRE, MTWO_WIP_WOSUF, MTWO_WIP_ATOTAL,
MTWO_WIP_CODE
FROM WORKORD where MTWO_WIP_WOPRE = " & WO
'do queries
CurrentDb.QueryDefs("DBA").SQL = sqlString
DoCmd.RunSQL "DELETE FROM Temp_WO;"
DoCmd.RunSQL "SELECT DBA.* INTO Temp_WO FROM DBA;"
'open form
DoCmd.OpenForm "Main"
DoCmd.Close acForm, "SW"
GetData_Exit:
Exit Function
GetData_Err:
MsgBox Error$
Resume GetData_Exit
End Function