Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2009
    Posts
    39

    Unanswered: Code working in After Update but not in On Current?

    I have this in my After Update box of the field:

    Me.tbxFAMS_VEH_TYPE = Me.tbxVEH_TYPE.Column(1)
    Me.tbxFAMS_SUV_JUST = Me.tbxVEH_TYPE.Column(2)
    Me.tbxFAMS_PU_JUST = Me.tbxVEH_TYPE.Column(3)
    Me.tbxFAMS_PRIM_APP = Me.tbxVEH_TYPE.Column(4)
    Me.tbxFAMS_Zip = Me.cbxUnit.Column(3)
    Me.tbxBILLING_CODE = Me.cbxUnit.Column(4)
    Me.PILOT.Visible = (Left(Me.VEH_TYPE, 11) = "fire engine")
    Me.BODY_MANUF_NMBR.Visible = (Left(Me.VEH_TYPE, 11) = "fire engine") Or (Left(Me.VEH_TYPE, 3) = "***") Or (Left(Me.VEH_TYPE, 3) = "ect")
    End Sub

    and the On Current for the form has the EXACT same information. So why are my records not updating? It works if I do it manually, but at 3000+ records, I would rather it did it at all at once...

    Help?

  2. #2
    Join Date
    May 2010
    Posts
    601
    Quote Originally Posted by SRR View Post
    I have this in my After Update box of the field:

    Me.tbxFAMS_VEH_TYPE = Me.tbxVEH_TYPE.Column(1)
    Me.tbxFAMS_SUV_JUST = Me.tbxVEH_TYPE.Column(2)
    Me.tbxFAMS_PU_JUST = Me.tbxVEH_TYPE.Column(3)
    Me.tbxFAMS_PRIM_APP = Me.tbxVEH_TYPE.Column(4)
    Me.tbxFAMS_Zip = Me.cbxUnit.Column(3)
    Me.tbxBILLING_CODE = Me.cbxUnit.Column(4)
    Me.PILOT.Visible = (Left(Me.VEH_TYPE, 11) = "fire engine")
    Me.BODY_MANUF_NMBR.Visible = (Left(Me.VEH_TYPE, 11) = "fire engine") Or (Left(Me.VEH_TYPE, 3) = "***") Or (Left(Me.VEH_TYPE, 3) = "ect")
    End Sub

    and the On Current for the form has the EXACT same information. So why are my records not updating? It works if I do it manually, but at 3000+ records, I would rather it did it at all at once...

    Help?
    There really is nothing to update.

    How are you doing it manually?

    Not sure what you mean by do it all at once.

    The on current event fires as a record is made current. This means is runs for only one record at a time.

    This code works fine for a form in single view mode.

    If you have a form in continuous or datasheet view mode, it will only change for the current (selected) record.

    Is your form in single view mode?
    Boyd Trimmell aka HiTechCoach HiTechCoach.com (free access stuff)
    Microsoft MVP - Access Expert
    BPM/Accounting Systems/Inventory Control/CRM
    Programming: Nine different ways to do it right, a thousand ways to do it wrong.
    Binary--it's as easy as 1-10-11

  3. #3
    Join Date
    Dec 2009
    Posts
    39
    I can't remember how, but I got it to work for all records in the the past. I solved the issue by just scrolling through all records and updating the info that way. Quick and dirty, but at least its done.

    Thanks!

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You probably ran an update query in the past. No form-based code is going to operate on all records (unless you're executing SQL or looping a recordset). As Boyd said, the Current event is only going to fire for a single record at a time.
    Paul

Posting Permissions

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