Posts

Application Switchboard

This is an application I wrote to allow user to easily launch there access programs. If you have used access for even a short time you will notice that the number of reports and application developed internally grows very quickly.

This application allows you to add the application its purpose and field location into a easy to search listing. The user can open the application at any time by double clicking on the listed item.

For more advanced users I have remmed out some registry setting to ensure compliance with the system in larger organisations. Please feel free to ask any questions you may have.

www.anythingaccess.com/download/emssb.zip

Who is using my database

When you need to edit a database in a large organisation where you have multiple users you have a number of options

1. kick them out using the server close files option
2. Look up the ldb file to see who has the file open

The problem with the second issue is the LDB file only stores the computer name and not the username or login.

My option is to store the computer and username when the user logins to the system. Create a table in the application ( not in the linked database) and add the columns ComputerName and UserName as text fields call the table tblUsers.

On your main form add an on open event as follows

Dim rst As Recordset
Set rst = CurrentDb.OpenRecordset("select * from tblUsers where ComputerName=" & Chr(34) & Environ("COMPUTERNAME") & Chr(34))
If rst.RecordCount = 0 Then
    'add the user
    rst.AddNew
    rst!UserName = Environ("UserName")
    rst!ComputerName = Environ("ComputerName")
    rst.Update
End If
Set rst = Nothing

When you need to update the program you will be able to identify any active users.
Another method to use involved having a hidden form which I will cover and cross link at a later date.

Access Dates

This is a simple function I use to convert UK Dates to American dates for use in SQL statements in my access programs.



Function ActDate(passeddate As Date)

Dim SqlStrDate
Select Case Month(passeddate)
Case 1
  SqlStrDate = Day(passeddate) & "/Jan/" & Year(passeddate)
Case 2
  SqlStrDate = Day(passeddate) & "/Feb/" & Year(passeddate)
Case 3
  SqlStrDate = Day(passeddate) & "/Mar/" & Year(passeddate)
Case 4
  SqlStrDate = Day(passeddate) & "/Apr/" & Year(passeddate)
Case 5
  SqlStrDate = Day(passeddate) & "/May/" & Year(passeddate)
Case 6
  SqlStrDate = Day(passeddate) & "/June/" & Year(passeddate)
Case 7
  SqlStrDate = Day(passeddate) & "/July/" & Year(passeddate)
Case 8
  SqlStrDate = Day(passeddate) & "/Aug/" & Year(passeddate)
Case 9
  SqlStrDate = Day(passeddate) & "/Sept/" & Year(passeddate)
Case 10
  SqlStrDate = Day(passeddate) & "/Oct/" & Year(passeddate)
Case 11
  SqlStrDate = Day(passeddate) & "/Nov/" & Year(passeddate)
Case 12
  SqlStrDate = Day(passeddate) & "/Dec/" & Year(passeddate)
End Select
ActDate = SqlStrDate
End Function