473,382 Members | 1,420 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Multiple users in db causing debug error.

beacon
579 512MB
I'm having some trouble with my database (what's new, right?) and an error message that seems to appear somewhat randomly for the users that are accessing it.

I'm using Access '03 and know it fairly well, but I may be lacking in some of the fundamental areas.

When I created the database I placed it on a shared folder on our network for roughly 15 users to access when they needed to enter data. The problem I'm having is that sometimes, when the users are entering data, a debug dialog box appears, opens the VBA code, and highlights a line of code I've written for a submit (and save) command I created.

My question is, do you have to do something special to allow more than one user to use a database simultaneously with another user or is my code preventing one user from saving if another has accessed the database prior.

Here's the line of code that highlights when the error appears:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSubmit_Click()
  2.     Dim subVal As Variant
  3.     subVal = MsgBox("Are you sure you want to submit?", vbYesNo + vbQuestion)
  4.     If subVal = vbYes Then
  5.         DoCmd.Save acForm, Me.Name
  6.         DoCmd.Close acForm, Me.Name
  7.         MsgBox "Your form was saved", vbOKOnly
  8.         DoCmd.OpenForm "Switchboard", acNormal
  9.     ElseIf subVal = vbNo Then
  10.         MsgBox "You will be returned to the form without saving", vbOKOnly
  11.         DoCmd.CancelEvent
  12.     End If
  13. End Sub
  14.  
The only thing extra I've done with this database is remove some of the options on the menu bar for the user to see and I hid the database navigation window. Other than that, I haven't done anything else, so if I was supposed to create an MDE (which I know nothing about) please let me know.

Thanks,
beacon

P.S. Thank heavens for a place like the scripts where people like me can come to find out how little they know, but actually get answers to the questions they ask to help them learn.
Nov 2 '07 #1
4 1765
Jim Doherty
897 Expert 512MB
I'm having some trouble with my database (what's new, right?) and an error message that seems to appear somewhat randomly for the users that are accessing it.

I'm using Access '03 and know it fairly well, but I may be lacking in some of the fundamental areas.

When I created the database I placed it on a shared folder on our network for roughly 15 users to access when they needed to enter data. The problem I'm having is that sometimes, when the users are entering data, a debug dialog box appears, opens the VBA code, and highlights a line of code I've written for a submit (and save) command I created.

My question is, do you have to do something special to allow more than one user to use a database simultaneously with another user or is my code preventing one user from saving if another has accessed the database prior.

Here's the line of code that highlights when the error appears:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSubmit_Click()
  2. Dim subVal As Variant
  3. subVal = MsgBox("Are you sure you want to submit?", vbYesNo + vbQuestion)
  4. If subVal = vbYes Then
  5. DoCmd.Save acForm, Me.Name
  6. DoCmd.Close acForm, Me.Name
  7. MsgBox "Your form was saved", vbOKOnly
  8. DoCmd.OpenForm "Switchboard", acNormal
  9. ElseIf subVal = vbNo Then
  10. MsgBox "You will be returned to the form without saving", vbOKOnly
  11. DoCmd.CancelEvent
  12. End If
  13. End Sub
  14.  
The only thing extra I've done with this database is remove some of the options on the menu bar for the user to see and I hid the database navigation window. Other than that, I haven't done anything else, so if I was supposed to create an MDE (which I know nothing about) please let me know.

Thanks,
beacon

P.S. Thank heavens for a place like the scripts where people like me can come to find out how little they know, but actually get answers to the questions they ask to help them learn.
Hi Beacon,

Do you have a handle on what error handling means? you have nothing in there not even the lazy mans line (On Error Resume Next)

Your program is going to bomb out with perplexing regularity if you don't have something in place to at least capture the basic errors of which one it seems to me is the following:

Why are you trying to save the form itself? my guess is you mean to save a record Yes? if correct (and by reading the lines I can see it must be) you have issued the wrong command when you should be considering

Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdSaveRecord
Do you know what 'splitting' an access database means?

How big roughly is your database? are you aware that placing a database on a network share means the mdb file has to be dragged over the network before a user can do anything?
It is more efficient to have each user with their own copy of a frontend database residing on the client maybe in their profile if they logon to a domain or at least in a folder having a common name on each client pc on a common drive assignment. You then link tables from the server to each frontend file and ensure they are linked on opening of the database.

By the way I like your PS it is kind of endearing

Regards

Jim :)
Nov 2 '07 #2
beacon
579 512MB
Hi Jim,

I haven't gotten much into error handling because my coding in VBA isn't all that great, although it does seem to get better every time I'm tasked with a new project.

I really enjoy coding in VBA, but the book I have isn't very descript in the philosphy of how to code or the components that make up the data members for a particular function. I'm sure this is my problem with the line of code I wrote that was giving me the error message, but I used it anyway since it appeared to be the best example in my book.

I could be wrong on this, but I think our shared drive is a standalone server that is the ideal place for something like a database. All I know is that our IT department put there instead of on a public drive.

My intention was, in fact, just to save the record so I'll use the docmd.runcommand you suggested instead. Do you think I should create an error handle for this?

My main concern is just that I'm hoping to be able to have more than one user enter and save data into the database without it causing any problems. My users will enter the same information a dozen or more times if they get an error message like that and then they will call me and tell me every time...it's actually pretty funny after about the 5th time.

My db is 120 mb, by the way.

Anyway thanks for the help...
Nov 2 '07 #3
Jim Doherty
897 Expert 512MB
Hi Jim,

I haven't gotten much into error handling because my coding in VBA isn't all that great, although it does seem to get better every time I'm tasked with a new project.

I really enjoy coding in VBA, but the book I have isn't very descript in the philosphy of how to code or the components that make up the data members for a particular function. I'm sure this is my problem with the line of code I wrote that was giving me the error message, but I used it anyway since it appeared to be the best example in my book.

I could be wrong on this, but I think our shared drive is a standalone server that is the ideal place for something like a database. All I know is that our IT department put there instead of on a public drive.

My intention was, in fact, just to save the record so I'll use the docmd.runcommand you suggested instead. Do you think I should create an error handle for this?

My main concern is just that I'm hoping to be able to have more than one user enter and save data into the database without it causing any problems. My users will enter the same information a dozen or more times if they get an error message like that and then they will call me and tell me every time...it's actually pretty funny after about the 5th time.

My db is 120 mb, by the way.

Anyway thanks for the help...
Hi Beacon,

We all learn as we experience stuff :) no question. It always pays to implement error handling though because you have to anticipate where your program might go wrong for your own long term sanity more than anything else LOL.

For instance whilst you might issue a save command the command itself might well be valid but it might be not able to actually perform it for instance where your disk might be full.

Even in your own program you might have allowed them to save by virtue of a command button being present and not disabled it and they click it but haven't completed mandatory fields. In each of these cases errors are generated and if there is no error handling certainly in the case of an MDE file they will get thown straight out the system or with an MDB file they see the VBA code window which is the last thing you want.

As for your server the fact its on a server is better than nothing but the 'split' database is the way to go for various reasons ie if one users copy on their machine was not performing you could work on their copy and maintain and not have to kick everyone of the system in order to do that.

Regards

Jim :)
Nov 2 '07 #4
ADezii
8,834 Expert 8TB
I'm having some trouble with my database (what's new, right?) and an error message that seems to appear somewhat randomly for the users that are accessing it.

I'm using Access '03 and know it fairly well, but I may be lacking in some of the fundamental areas.

When I created the database I placed it on a shared folder on our network for roughly 15 users to access when they needed to enter data. The problem I'm having is that sometimes, when the users are entering data, a debug dialog box appears, opens the VBA code, and highlights a line of code I've written for a submit (and save) command I created.

My question is, do you have to do something special to allow more than one user to use a database simultaneously with another user or is my code preventing one user from saving if another has accessed the database prior.

Here's the line of code that highlights when the error appears:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSubmit_Click()
  2.     Dim subVal As Variant
  3.     subVal = MsgBox("Are you sure you want to submit?", vbYesNo + vbQuestion)
  4.     If subVal = vbYes Then
  5.         DoCmd.Save acForm, Me.Name
  6.         DoCmd.Close acForm, Me.Name
  7.         MsgBox "Your form was saved", vbOKOnly
  8.         DoCmd.OpenForm "Switchboard", acNormal
  9.     ElseIf subVal = vbNo Then
  10.         MsgBox "You will be returned to the form without saving", vbOKOnly
  11.         DoCmd.CancelEvent
  12.     End If
  13. End Sub
  14.  
The only thing extra I've done with this database is remove some of the options on the menu bar for the user to see and I hid the database navigation window. Other than that, I haven't done anything else, so if I was supposed to create an MDE (which I know nothing about) please let me know.

Thanks,
beacon

P.S. Thank heavens for a place like the scripts where people like me can come to find out how little they know, but actually get answers to the questions they ask to help them learn.
I've made modifications to your code and also included basic Error Handling Functionality for you to see. Also, do not declare the Return Value from Msgbox() as a Variant, it should be Integer as indicated.
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdSubmit_Click()
  2. On Error GoTo Err_cmdSubmit_Click
  3.  
  4. Dim subVal As Integer      'Not Variant
  5.  
  6. subVal = MsgBox("Are you sure you want to submit?", vbYesNo + vbQuestion)
  7.  
  8.   If subVal = vbYes Then
  9.     'I'll leave the questionable line in place
  10.     DoCmd.Save acForm, Me.Name
  11.     DoCmd.Close acForm, Me.Name
  12.     MsgBox "Your form was saved", vbOKOnly
  13.     DoCmd.OpenForm "Switchboard", acNormal
  14.   Else   'only 2 Options exist (if not Yes, must be No)
  15.       MsgBox "You will be returned to the form without saving", vbOKOnly
  16.       DoCmd.CancelEvent
  17.   End If
  18.  
  19. Exit_cmdSubmit_Click:
  20.     Exit Sub
  21.  
  22. Err_cmdSubmit_Click:
  23.     MsgBox Err.Description, vbExclamation, "Error in cmdSubmit_Click()"
  24.     Resume Exit_cmdSubmit_Click
  25. End Sub
Nov 2 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: DaveK | last post by:
We have a development iis6.0 server. Multiple programmers are developing independent applications. Non are sitting on the machine they all develop on their own system. Regularly they try to debug...
3
by: DarthMacgyver | last post by:
Hello, I recently wrote a survey application. Each question is very similar. The first questions gives me a problem when there are multiple people taking the survey (The Database connection...
3
by: KemperR | last post by:
Hello Experts outhere, may be someone can tell me whats going wrong with my ADOX trial. I have an Access 2002 database with some tables and queries (views) The code listed below works well up...
6
by: mark | last post by:
I have an asp.net ecommerce web application on a remote web server. I'm using an Access database on the back end. I've notice a few strange things. When I mimic an multiple user environment by...
6
by: James Radke | last post by:
Hello, I have a multithreaded windows NT service application (vb.net 2003) that I am working on (my first one), which reads a message queue and creates multiple threads to perform the processing...
0
by: Aryan | last post by:
Hi All, My application was working fine and giving me proper trace messages, but now all of sudden it started showing expcetion as "Object reference not set to an instance of an object....
2
by: f rom | last post by:
----- Forwarded Message ---- From: Josiah Carlson <jcarlson@uci.edu> To: f rom <etaoinbe@yahoo.com>; wxpython-users@lists.wxwidgets.org Sent: Monday, December 4, 2006 10:03:28 PM Subject: Re: ...
12
by: micarl | last post by:
How would i print a report based on criteria selected from several Combo Boxes as well as multiple Multi Select List Boxes, that are located on the same form? I can get one Multi List Box, just...
0
it0ny
by: it0ny | last post by:
Hi guys, thanks I am fairly new to this forum so I hope I chose the right place to post this question. I try to make my program printout a deposit's report. I created a class to store the...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.