Results 1 to 8 of 8
  1. #1
    Sue22's Avatar
    Sue22 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    15

    Setting a couple of global values??


    Right so I have a database which is split. I have two values which are universal and only change occasionally so I don't want them in a table against every record in the database. I have currently set them up as globals in a module I want to set it up so I can draw the values in from the backend database rather than having to edit every single copy of the front end each time. anybody any ideas???

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    If you want a value to be available to multiple users you will need to store the value in a table. However, you do not need to duplicate this value in multiple records or in multiple tables. For instance, if you want to communicate to everyone in the office that Elvis has left the building, you could update one record within tblElvis. The best approach for a situation like this would likely be to create a new record every time the status of Elvis changed. A timestamp would indicate which record within tblElvis has the valid status.

  3. #3
    Sue22's Avatar
    Sue22 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    15
    Sounds good but how do I then extract the most recent value using VBA??

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    If there is only one record in a table, no criteria is needed. If you append a new record each time the status of something changes, use criteria in a query to find the most recent change. I usually use a column in a table of data type Date. You can set the default value of the column while in design view of your table. You can add Date() in the Default Value property of your Date column. The most current status will be the record with the latest date in its Date column.

  5. #5
    Sue22's Avatar
    Sue22 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    15
    I've tried to figure out the VBA to get the data out but this is the bit that stumps me????

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    You can use various ways to retrieve data from a table. Many approaches use a Query at some point. Have you tried using a query object? If you want to use VBA, a DMax method might work. Maybe something like
    MsgBox = DMax("[MyDateField]", "TableName")

  7. #7
    Sue22's Avatar
    Sue22 is offline Novice
    Windows 8 Access 2013
    Join Date
    Mar 2015
    Posts
    15
    Brilliant all sorted. Thanks

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Glad to hear!

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

Similar Threads

  1. Setting textbox values on a report using vba
    By Markb384 in forum Reports
    Replies: 6
    Last Post: 01-24-2014, 09:54 AM
  2. Setting Up DB with numeric values
    By dashingirish in forum Access
    Replies: 4
    Last Post: 02-17-2012, 03:41 PM
  3. setting values of multiple controls
    By desimoreno in forum Forms
    Replies: 9
    Last Post: 12-14-2011, 02:54 PM
  4. Setting global variables
    By Remster in forum Programming
    Replies: 1
    Last Post: 08-24-2011, 08:47 AM
  5. Setting default values in columns
    By crownedzero in forum Programming
    Replies: 0
    Last Post: 06-17-2009, 06:45 AM

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