Auto Refreshing
I'm using the example code from the "solutions"/"northwind" dbs and have some questions on how to adapt it. I'm not very familiar with VB and I thought I would post this to see if I am on the right track and if there are any syntax issues
I like the feature where it asks you to locate the database. I'm assuming that the database it is looking for is the backend.
Also, the following code is confusing to me. I'm not follwing what it is doing. Unlike the "solutions" database my database will not be in the same directory as Access.
' Get name of directory where MSAccess.exe is located.
strAccDir = SysCmd(acSysCmdAccessDir)
' Get the default sample database path.
If Dir(strAccDir & "Samples\.") = "" Then
strSearchPath = strAccDir
Else
strSearchPath = strAccDir & "Samples\"
End If
' Look for the Northwind database.
If (Dir(strSearchPath & "Northwind.mdb") <> "") Then
strFileName = strSearchPath & "Northwind.mdb"
Else
' Can't find Northwind, so display the Open dialog box.
MsgBox "Can't find linked tables in the Northwind database. " _
& "You must make sure the Northwind sample database is " _
& "installed. If Northwind is installed, you must locate " _
& "Northwind in order to use " _
& conAppTitle & ".", vbExclamation
strFileName = FindNorthwind(strSearchPath)
If strFileName = "" Then
strError = "Sorry, you must locate Northwind to open " & conAppTitle & "."
GoTo Exit_Failed
End If
End If
I'm thinking that is should be changed to something like the following where I just state the path that I would install it in.
' Get name of directory where MSAccess.exe is located.
' Get the default sample database path.
strSearchPath = "c:\mydbdirectory\mydatabasefrontend.mdb?"
[or whatever path]
' Look for the Northwind database.
If (Dir(strSearchPath & "Northwind.mdb") <> "") Then
strFileName = strSearchPath & "Northwind.mdb"
Else
' Can't find Northwind, so display the Open dialog box.
MsgBox "Can't find linked tables in the Northwind database. " _
& "You must make sure the Northwind sample database is " _
& "installed. If Northwind is installed, you must locate " _
& "Northwind in order to use " _
& conAppTitle & ".", vbExclamation
strFileName = FindNorthwind(strSearchPath)
If strFileName = "" Then
strError = "Sorry, you must locate Northwind to open " & conAppTitle & "."
GoTo Exit_Failed
End If
End If