Thread: Opening a form with specefic ID
10-19-12, 06:34 #1Registered User
- Join Date
- Sep 2012
Unanswered: Opening a form with specefic ID
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.
If it does exist I want the form to open with the ID which is typed in the inputbox, the form does open but is showing blank.
Here is my 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
Last edited by j9070749; 10-19-12 at 06:38. Reason: To put code tags in
10-19-12, 06:47 #2Jaded Developer
Provided Answers: 59
- Join Date
- Nov 2004
- out on a limb
is this a VB, a VBA or an Access problem?I'd rather be riding on the Tiger 800 or the Norton