Results 1 to 5 of 5
  1. #1
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41

    Go to selected record

    I have two forms: customerinfo and customerorder

    Once information is entered into the customer info field I want the user to be able to edit an existing order but only if an order already exists.

    In the click event of the Edit Exisitng Order btn I have:

    Private Sub btnEEO_Click()
    On Error GoTo Err_btnEEO_Click


    Dim stDocName As String
    Dim stLinkCriteria As String
    Dim RecordCount As Integer
    RecordCount = DCount("CustomerID", "qryCustomerOrder")
    If RecordCount > 0 Then
    stDocName = "frmCustomerOrder"
    stLinkCriteria = "[CustomerID]=" & "'" & Me![txtCustomerID] & "'"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    Else
    MsgBox "No Order Exists"
    End If

    Exit_btnEEO_Click:
    Exit Sub
    Err_btnEEO_Click:
    MsgBox Err.Description
    Resume Exit_btnEEO_Click

    End Sub

    If an order doesn't already exist for the customer, the customer order form should not appear. For some reason my code is not working correctly but I cannot identify why.

  2. #2
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    What exactly is not working?

    Why are these two forms, can you make the second form a subform?

  3. #3
    Newbie11 is offline Advanced Beginner
    Windows 2K Access 2003
    Join Date
    Dec 2011
    Posts
    41
    Sorry I thought I uploaded the database.

    When I click the edit exsting order button the customer order form is opened regardless of if there is a current order or not to a blank form. This is not what I am desiring. I ony want the customer order form to be opened to the selected record in editing mode if the customer already has a order.

    Thanks for any insight you can offer.

  4. #4
    aytee111 is offline Competent At Times
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Location
    Nomad
    Posts
    3,936
    I have made it a subform. It makes a lot more sense.
    (Don't overwrite your existing database with this new one, BTW!)

  5. #5
    hamish mather is offline Novice
    Windows XP Access 2003
    Join Date
    Dec 2011
    Posts
    6

    Smile Hope this works for you

    I new at this

    I hope this works for you

    good luck

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 08-19-2011, 02:57 PM
  2. Replies: 1
    Last Post: 07-28-2011, 08:34 AM
  3. How to Print Selected Record
    By indranx in forum Reports
    Replies: 2
    Last Post: 05-31-2011, 09:54 PM
  4. Copying selected fields to a new record
    By Lyle Bitikofer in forum Forms
    Replies: 0
    Last Post: 12-13-2009, 04:01 PM
  5. Loading the form with selected record
    By emilylu3 in forum Access
    Replies: 1
    Last Post: 12-09-2005, 07:49 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums