开发者

MS Access - Open database form from URL

开发者 https://www.devze.com 2023-03-29 09:18 出处:网络
I\'m trying to open a form from an url. This ms access database will be hosted on a shared folder in an network, and the costumer has asked me if it\'s possible to open an database form (i\'ll have to

I'm trying to open a form from an url. This ms access database will be hosted on a shared folder in an network, and the costumer has asked me if it's possible to open an database form (i'll have to pass an ID).

If this were in web enviro开发者_JAVA百科nment i would do this without any problem, but honestly in ms access i have no idea how to do this.

Can someone help me?


Have a look at Register protocol and Registering an Application to a URL Protocol. They have a example registry file on how to register a protocol:

REGEDIT4

[HKEY_CLASSES_ROOT\foo]
@="URL:foo Protocol"
"URL Protocol"=""

[HKEY_CLASSES_ROOT\foo\shell]

[HKEY_CLASSES_ROOT\foo\shell\open]

[HKEY_CLASSES_ROOT\foo\shell\open\command]
@="\"C:\\Program Files\\Application\\program.exe\" \"%1\"" 

You can change the last line to something like:

@="\"C:\\Program Files\\Office\\access.exe\" \"C:\\path\\to\\your\\db.mdb\" /cmd \"%1\"" 

If you URL is foo:241245, the following command is called:

"C:\Program Files\Office\access.exe" "C:\path\to\your\db.mdb" /cmd "241245"

In Access, the commandline arguments are returned by the Command function:

In the direct window:

?Command
241245


The database can be opened from a URL like any other file:

file://server/share/path/database.mdb

This won't work if the database has user-level security on it though. I've only ever done that by using a windows shortcut.

If you're not using user-level security and the URL works, you can set the desired form to open automatically on load by going to the Access Options screen and the Current Database tab, then selecting the desired form from the Display Form drop-down list.

Oops - I just noticed that you said you'd need to pass an ID. I don't know if that's possible using a URL.


  1. Open your Access database from the network location (i.e., with a UNC path, not from a drive letter, or locally).

  2. Navigate so you can see the form listed in your database.

  3. Drag the form to your desktop. A shortcut directly to the form will be created there.

I don't think this is a good idea, though. It's a substitute for a user interface in your Access application. Additionally, your description of the problem sounds like you're intending to have multiple people opening the same database file. This is a really bad practice -- best practice is for the database to be split (back end with data tables only on the server, and individual copy of the front end with forms/reports/etc. on each user's workstation), and more than one user should never be opening the same front end at the same time.

0

精彩评论

暂无评论...
验证码 换一张
取 消