 |
| Access VBA Discuss using VBA for Access programming. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

August 2nd, 2007, 08:33 AM
|
|
Authorized User
|
|
Join Date: Jun 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
2 People viewing same query
I am looking to be able to have a pop up box on a form, so that when another user goes into the same job number they know its allready open by someone else.
Currently I have a table called tblSession this inputs the UserName, JobNumber and DateTime everytime a user goes into any job number, once they come out of that job their details are deleted from the table. How do I write some code so that it tell the user via pop up box that User X is already in this job?
I know that in excel I would do a lookup to the reference table, but just not sure in access.
Thanks,
Jez
|
|

August 3rd, 2007, 12:31 PM
|
|
Friend of Wrox
|
|
Join Date: Nov 2004
Posts: 1,621
Thanks: 1
Thanked 3 Times in 3 Posts
|
|
Control all access to the data in question so that it is through from's you have written.
Create a public counting variable in a module.
Any time the form opens, increment the variable.
If before the increment it is > 0, or after the increment it is > 1, display your message.
In the close/unload event of the form, decrement the variable.
|
|

August 6th, 2007, 04:46 AM
|
|
Authorized User
|
|
Join Date: Jun 2007
Posts: 41
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thanks for the reply, but dont really understand what you mean, could you explain a bit more please.
Jez
|
|

August 6th, 2007, 11:39 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Take the job number from the form, then look it up in the table. If it is there, then close the job form and pop up a message.
How are they opening the job form? This is the same process that puts the job number in the session table. Do they select a job number and click a button? If so, this is easy.
Please post more details.
mmcdonal
|
|

August 8th, 2007, 09:40 AM
|
|
Authorized User
|
|
Join Date: Jul 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
To solve your problem you can try this approach
1) Create a columns called "STATUS" in the table where you insert your job details
2) When a user open a particular jobno, set the status to "OPEN"
3) When a user try to open a particular job, check the status of the job. If its "OPEN" display a message that the job is open.
__________________
Vikash Kumar Singh
|
|

August 8th, 2007, 10:17 AM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
Would there be record locking issues with this solution? One user has it open and locked and another is trying to take information from it? Or would that only be a write issue? I like this solution. Just add a WHERE clause to your open statement to prevent the form opening. And add an event On Open to check for records and pop up a message and go back to the originating form.
mmcdonal
|
|

August 8th, 2007, 10:44 AM
|
|
Authorized User
|
|
Join Date: Jul 2007
Posts: 35
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
There will be no Locking issue.
It depends what you want to do, when one user has open the record(JOB), what the application want, to display a message or let him read only access to the record.
__________________
Vikash Kumar Singh
|
|
 |