I am trying to open a form with the ID from an inputbox (the ID is a number), if the ID does not exist a error messege pops up, which works.
If it does exist I want the form to open with the ID which is typed in the inputbox, which does not work, instead, the form does open but is showing blank.
Here is my code:
Thanks
If it does exist I want the form to open with the ID which is typed in the inputbox, which does not work, instead, the form does open but is showing blank.
Here is my code:
Code:
Dim strfrm, strWhere, strpono, inputBoxRes As String
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("TblOrder", dbOpenDynaset, dbSeeChanges)
strpono = InputBox("Please enter the purchase order number of the report you wish to view", "Enter PO No")
rs.FindFirst "PurchaseOrderNo =" & strpono
If Not rs.NoMatch Then
strfrm = "frmorder"
strWhere = "PurchaseOrderNo = " & strpono
DoCmd.OpenForm strfrm, , , strWhere
Else
MsgBox "There is no order with this Purchase Number. Please try again, or look through the report 'all orders' to find out the Purchase Order", vbInformation, "No Purchase Order Found"
End If
Set rsorder = Nothing
Thanks