Results 1 to 4 of 4
  1. #1
    Kundan is offline Competent Performer
    Windows XP Access 2013 32bit
    Join Date
    Mar 2018
    Posts
    155

    Regarding choice of Form Event


    With Reference to the attached DB I would like to know on which event of the Form should I place the code so that it will apply even to the first record on opening the Form. At present I have kept the code on the ‘On Current’ Event of the Form. But it affects only the subsequent records. The first record remains unaffected.
    Attached Files Attached Files

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,522
    ‘On Current’ works on the 1st record the form opens on. I use it.

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,651
    You dont have any code for the first record.

    Code:
    Private Sub Form_Current()
    Select Case [Expense Type]
        Case "Conveyance"
        Case "Miscllaneous"
        Case "Other"
        Case "Repair & Maintenance"
        Case "Sanitation Expenses"
        
        Case "Temporary Wages"
       ' MsgBox "Expense"
            [Issued].Enabled = True
            [Recvd].Enabled = False
       
        Case Else
       ' MsgBox "Receipt"
           [Recvd].Enabled = True
           [Issued].Enabled = False
    End Select
    End Sub
    The first record is "Sanitation expense". You dont have any code in that select case element. The fact that it may appear to work in subsequent records may just be luck.

    Why a memo field as a Primary key? It appears to be sequential numbering. Why not an autonumber?

    You should also eliminate spaces in object naming and take advantage of using the Me keyword.
    You may also want to use a lookup table for Particulars and Expense types.

  4. #4
    ssanfu is offline Master of Nothing
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664

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

Similar Threads

  1. Replies: 7
    Last Post: 09-14-2017, 02:24 AM
  2. Replies: 0
    Last Post: 03-19-2017, 01:29 PM
  3. Print form to choice of printers
    By gg80 in forum Programming
    Replies: 6
    Last Post: 08-21-2015, 10:46 AM
  4. Replies: 7
    Last Post: 05-08-2014, 10:34 AM
  5. How do I put a multi-choice option on my form?
    By Dollydriver in forum Forms
    Replies: 13
    Last Post: 02-09-2011, 05:40 PM

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