Results 1 to 3 of 3
  1. #1
    mseeker22 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Jun 2011
    Posts
    35

    Form Code refresh on open

    When I open the form 'Customer Overview' for the first time after closing and then re-opening the database it brings up the search parameter boxes for each of the criteria required from the queries. If I then go to design view and click on the ... (elipsis) button against the 'Form' On Open to view the code. Save and then close the VBA screen the form then opens normally for the remaining time spent in the database.



    Below is all the code attached to this form . . . any ideas?

    Code:
    Option Compare Database
    
    'Go to Customer Search'
    Private Sub CmdFindCustomer_Click()
        DoCmd.Close acForm, "Customer Overview", acSaveYes
        DoCmd.OpenForm "F_Booking Customer Search"
    End Sub
    
    'Go to Enter new Riding Club details'
    Private Sub CmdRCEnterReceiptDetails_Click()
        DoCmd.OpenForm "F_EnterRCUsage"
    End Sub
    
    'Show Riding Club Card image when Customer is a Riding Club Member'
    Private Sub Form_Current()
    If Me.Riding_Club_Card_Number = True Then
        Me.RCMemberImage.Visible = True
        Else
        Me.RCMemberImage.Visible = False
        End If
    End Sub
    
    'On open, close Customer Search Form'
    Private Sub Form_Open(Cancel As Integer)
        DoCmd.Close acForm, "F_Booking Customer Search", acSaveYes
        Me.Recalc
    End Sub
    
    'Go to Enter Riding Club Data'
    Private Sub RCMemberImage_Click()
        DoCmd.OpenForm "F_EnterRCUsage"
    End Sub
    . . . and the forms Control Source is-

    Code:
    SELECT Customers.*, [Riding Club Members].[Riding Club Card Number], [Riding Club Members].[Stable Cards Redeemed (5)], [Riding Club Members].[Authorised By], [Riding Club Members].[Join Date] FROM Customers LEFT JOIN [Riding Club Members] ON Customers.[Customer Number]=[Riding Club Members].[Customer Number];
    Thanks

  2. #2
    Rod is offline Expert
    Windows Vista Access 2007
    Join Date
    Jun 2011
    Location
    Metro Manila, Philippines
    Posts
    679
    The form's control source as you call it is not showing; please repost. I hope this is simply a typo since a form does have a record source but not a control source.

    What are these queries (plural!) you mention? Are there calculated field values in the form since you use Me.Recalc? Remember the Open event occurs before the first record is displayed.

    Otherwise, I can see nothing wrong with the event handlers.

  3. #3
    SteveH2508 is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Sep 2010
    Location
    Chelsea, London, England
    Posts
    117
    A couple of observations:

    Lines 5 and 25 you use acSaveYes in your DoCmd.Close acForm line.
    acSaveYes saves design changes to the form - are you sure you want to do that? Normally you would use acSaveNo here.

    In your Form_Open code the Me.Recalc is not necessary.

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

Similar Threads

  1. Replies: 21
    Last Post: 02-14-2011, 02:51 PM
  2. Refresh Form
    By tpcervelo in forum Forms
    Replies: 7
    Last Post: 02-07-2011, 08:03 AM
  3. Replies: 3
    Last Post: 10-04-2010, 01:31 PM
  4. refresh a form
    By RedGoneWILD in forum Forms
    Replies: 18
    Last Post: 09-03-2010, 08:31 AM
  5. Replies: 2
    Last Post: 02-26-2010, 08:14 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