Results 1 to 3 of 3
  1. #1
    Join Date
    Jul 2014
    Posts
    3

    VBA is causing my imported data to change when I open it in form view

    I appended imported data from Excel to my main table, and all appended values are there. However, when I open my form to view a data row in FormView, certain fields are erased without my doing anything except open, view, and close the form. I suspect it's because of the way I have my VBA set up.

    Private Sub SUSPEND_AfterUpdate()


    HandleSuspension
    End Sub

    Private Sub HandleSuspension()
    If Nz(Me.SUSPEND, 0) Then
    Me.DATE_EFFECTIVE.Enabled = True
    Else
    Me.DATE_EFFECTIVE = Null
    Me.DATE_EFFECTIVE.Enabled = False

    End If
    End Sub

    Both SUSPEND and DATE_EFFECTIVE are the fields getting erased. And upon form open, the DATE_EFFECTIVE field is still grayed out because the SUSPEND isn't checked even though both previously existed in TableView. Is it because of the AfterUpdate event? How can I solve for this problem?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2013
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    You do not get an AfterUpdate event unless you change the value in the control through the user interface (UI). Open, View and Close will not cause this to happen.

  3. #3
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    In addition to Allan's comment, what exactly is the purpose of this line
    Code:
    If Nz(Me.SUSPEND, 0) Then
    ? What data type is SUSPEND?

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

Similar Threads

  1. VBA in form view overriding imported table data
    By thoughtgrenade in forum Forms
    Replies: 3
    Last Post: 07-22-2014, 09:54 AM
  2. Replies: 2
    Last Post: 04-29-2014, 05:03 PM
  3. Use a form to VIEW but not CHANGE
    By ZLHysong in forum Access
    Replies: 16
    Last Post: 01-10-2013, 06:00 AM
  4. change heading in data sheet view
    By sharad.rt in forum Forms
    Replies: 4
    Last Post: 07-21-2012, 12:54 PM
  5. Replies: 3
    Last Post: 04-20-2012, 04:33 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