Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I am running a application that uses a access database.

This database is stored in a mapped network folder and is used by more than 1 client machine.

I want to update a field in the access database before running the application from each client workstation.

I want to do it from a batch file where I will first perform an update in the access database and then start the application in the batch file.

This way I will create a batch file on each client and change the content of the update field based on the client unless if there is an easy way out.

Please let me know how to do this.

Thanks in advance

What I have tried:

i have tried running a macro in database but it is not working
Posted
Updated 13-Apr-16 2:48am
Comments
CHill60 13-Apr-16 8:08am    
That is not a nice way to go about this. You would have to have a VBA macro on the database and start Access (from the batch file) using the appropriate command line switches.
It's not clear what you mean by "change the content of the update field based on the client" but you should be doing this from within your application.
Member 12456655 13-Apr-16 8:26am    
Apologies for not being clear.

An application is installed on 2 client machine which uses the same access database on a mapped network folder.

Before starting the application from a client machine I want to update a field in the access database.

For example when i run the application from client 1 I want to update the database field as 'client-1' and when run from client 2 i will update the field as 'client2'.

Any help on how to do this will be really appreciated x 100 times.

Regards,
CHill60 13-Apr-16 8:30am    
Then do that in your application once it has loaded. You can use various ways of identifying client 1 or 2 that are far more robust that hard-coding a value in a batch file (which you just should not be using to start your program). You could read their logon name from the computer for example - you haven't said what kind of application you have so I can't help you further
Member 12456655 13-Apr-16 9:32am    
we are not using it as multi user. we just want to use it from other client also. Thats it..not as a multi user. Want to give access from another client machine also..pls let me know how to update the field..
CHill60 13-Apr-16 9:42am    
I didn't mention multi-user! As I said, you haven't mentioned what language your application is written in so I can't really help you.
Presumably your application is already connecting to the database and is reading and updating fields on it?

1 solution

Don't try to use a batch file - it isn't necessary and it causes problems. For example, to use it, Access would have to be installed on each computer - which it would be best to avoid as the user would then have direct access to the DB instead of via the batch file / your application.
You could write a small "companion app" which does just what you want to do via the batch file (and it could start your app at the end as well), but a better solution is to add the function to the startup code for your app. Remember that your app can have individual settings files for each PC it is installed on.
But I think you are setting yourself up for problems anyway but using an Access file. Access isn't good in a multi-user environment (although it is possible to use it) - it's primarily a single user database and I've always had annoying intermittent problems when I try to subvert that. If you are having multiple users on the same DB, you really need to look at a server-based system such as SQL Server or MySQL. You really will save yourself a a lot of work (and from a world of pain) in the long term.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900