Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2012
    Posts
    21

    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:

    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
    Last edited by j9070749; 10-19-12 at 06:38. Reason: To put code tags in

  2. #2
    Join Date
    Nov 2004
    Location
    out on a limb
    Posts
    13,692
    Provided Answers: 59
    is this a VB, a VBA or an Access problem?
    I'd rather be riding on the Tiger 800 or the Norton

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •