Results 1 to 2 of 2
  1. #1
    3 Star Lounger
    Join Date
    Jul 2001
    Posts
    280
    Thanks
    0
    Thanked 0 Times in 0 Posts

    for each (Access 2000)

    In the OnClose event of the form i want to put a code checking the field Me!afid for each row
    and if afid is null, to enter the following number:

    Me![afid] = Me![office]


    I think i will need a for each..next line. How can i do it?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: for each (Access 2000)

    I would do this in the Before Update event of the form, not in the On Close event:

    Private Sub Form_BeforeUpdate(Cancel As Integer)
    If IsNull(Me.afid) Then
    Me.afid = Me.office
    End If
    End Sub

    To set this for existing records, you can create an update query and run it once.

Posting Permissions

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