Results 1 to 9 of 9
  1. #1
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107

    On Load VBA

    Hello,

    I currently store a date in a table when I run my import macro. I would like to display this date on my navigation form as a Data Date. I tried this but it does not work Me.DataDate = [tblObjectImport]![TimeStamp]

    This is what I have for on load event

    Private Sub Form_Load()
    Dim Security As Integer
    Me.Text362 = Environ("USERNAME")
    Me.DataDate = [tblObjectImport]![TimeStamp]
    Security = DLookup("AccessID", "tblObjectUser", "[USERNAME] = '" & Me.Text362 & "'")
    If Security = 2 Then
    Me.NavigationButton53.Enabled = True 'Admin'
    Else
    Me.NavigationButton53.Enabled = False 'Admin'
    End If


    End Sub

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    add a ImportDate field to the table , set the DEFAULT = DATE()
    no code needed.

  3. #3
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    This date is static and not necessarily today. This is why I put it in a table.

  4. #4
    Minty is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,003
    Then use a DLookup() to get it's value.
    Currently it won't know what [tblObjectImport]![TimeStamp] is or evaluates to.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  5. #5
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    Sorry but how exactly? If the table is [tblObjectImport]![TimeStamp] and the field that I want to populate is DataDate

  6. #6
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    If date is static but not necessarily today then where does it come from? If it's already in a record then what criteria can be used to search for it? The most recent?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  7. #7
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    There is only one record which is replaced each time the update macro is updated.

  8. #8
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    A one-record table?

    Me.DataDate = DLookup("TimeStamp", "tblObjectImport")
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  9. #9
    sparker75 is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Jul 2018
    Posts
    107
    Work thank you very much!

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

Similar Threads

  1. On Load Help
    By NikoTheBowHunter in forum Access
    Replies: 3
    Last Post: 12-28-2017, 07:36 AM
  2. filter load
    By slimjen in forum Forms
    Replies: 11
    Last Post: 08-06-2014, 10:25 AM
  3. Replies: 12
    Last Post: 03-27-2014, 04:49 AM
  4. Cant load all data
    By skifreak in forum Programming
    Replies: 2
    Last Post: 03-15-2013, 05:38 AM
  5. Northwind - how to load
    By KHill in forum Access
    Replies: 4
    Last Post: 07-10-2012, 07:37 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