B
BruceM via AccessMonster.com
Actually, there are a couple of questions here. I will get to the topic in
the subject line shortly, but the first question leads to that one.
I am setting up a database that uses hard-coded values for things such as the
location address. However, the database will be used in other locations, so
I have made a LocationsVariables table. There is a single record, with maybe
8-10 fields. When I need one of the values I use a DLookup:
DLookup("[SomeField]","[tblLocVariables]")
With only one record the DLookup seems efficient enough. I assign it to a
variable within a procedure if necessary to use it several times within a
single procedure. However, I wonder if there is a way to assign the variable
once when the startup form opens. I am reluctant to use a global variable
because of concerns about it being reset by an unhandled error. I use error
handling in all procedures and functions, but still it seems that a global
variable is potentially fragile.
The IP address part of the question is that for some reason the server name
does not always work as part of a path, but the IP address does. I need to
use network paths in some places, but on some computers this has not been
working. I expect it is a configuration problem of some kind, but it seems
it may not be addressed any time soon, if at all. I have found code to
convert server name to IP address. In my tests it works very well. I wonder
if there are potential issues with using the IP address rather than the
server name. If it is OK to convert, the server name would be one of the
LocationVariables, and I would run the IP conversion code using that value.
Again, the question arises whether it is best to store the value once or run
the function each time the IP address is needed. As an alternate approach,
LocationVariables data would be editable by only a few people, but it should
be possible to store the IP address in a table by running the code when the
server name is first entered via the LocationVariables form. Thereafter each
user would run the IP address function when starting the database and compare
it to the table value. If they match, no problem. If not, they could get a
message box advising them to contact somebody or other.
the subject line shortly, but the first question leads to that one.
I am setting up a database that uses hard-coded values for things such as the
location address. However, the database will be used in other locations, so
I have made a LocationsVariables table. There is a single record, with maybe
8-10 fields. When I need one of the values I use a DLookup:
DLookup("[SomeField]","[tblLocVariables]")
With only one record the DLookup seems efficient enough. I assign it to a
variable within a procedure if necessary to use it several times within a
single procedure. However, I wonder if there is a way to assign the variable
once when the startup form opens. I am reluctant to use a global variable
because of concerns about it being reset by an unhandled error. I use error
handling in all procedures and functions, but still it seems that a global
variable is potentially fragile.
The IP address part of the question is that for some reason the server name
does not always work as part of a path, but the IP address does. I need to
use network paths in some places, but on some computers this has not been
working. I expect it is a configuration problem of some kind, but it seems
it may not be addressed any time soon, if at all. I have found code to
convert server name to IP address. In my tests it works very well. I wonder
if there are potential issues with using the IP address rather than the
server name. If it is OK to convert, the server name would be one of the
LocationVariables, and I would run the IP conversion code using that value.
Again, the question arises whether it is best to store the value once or run
the function each time the IP address is needed. As an alternate approach,
LocationVariables data would be editable by only a few people, but it should
be possible to store the IP address in a table by running the code when the
server name is first entered via the LocationVariables form. Thereafter each
user would run the IP address function when starting the database and compare
it to the table value. If they match, no problem. If not, they could get a
message box advising them to contact somebody or other.