New records in form

lostside

Registered User.
Local time
Today, 05:54
Joined
Aug 10, 2009
Messages
15
Hi!
i have an access database where users use a form to input data into the DB.
when a user insert a new record after some validation the code i use to move to the new record is:
DoCmd.GoToRecord , , acNewRec
this works fine whith a single user, but when more users start to use the same form, the DB gets unstable and crashes many times during the day, where the user has to restart the bd.
i replaced the code above with this:
DoCmd.Close
DoCmd.OpenForm "formname", , , stLinkCriteria
And the DB never crashed again no metter the number of user that are loged on.
the only problem is that when i use
DoCmd.Close
DoCmd.OpenForm
insted of
DoCmd.GoToRecord , , acNewRec
the form reopens in the center of the screen, and i wish that it stayed in the same place when users add new records.
one other thing i might add is that the table has a id value that is set to autonumber.
any ideas why the DB is not stable with DoCmd.GoToRecord , , acNewRec?
 
Question 1: Do you have a copy of the front end on each workstation?
 
no. i have one mdb file in a shared folder that everyone use
 
You might resolve your issue if you use a frontend/backend setup. Search the forum on the topic as it has been covered numerous times very thoroughly.
 
See, you've found the problem! A single, non-split database run by multiple users is a sure fired path to corruption. You need to use the database splitter to place the tables in a Back End, placing it on the shared folder, and everything else in a Front End, with each user having a copy on their PC.
 
ok, so with this splitt do you think ill be able to use

DoCmd.GoToRecord , , acNewRec

wothout problems?

i still don't get whit the DB works with
DoCmd.Close
DoCmd.OpenForm

and crash with
DoCmd.GoToRecord , , acNewRec
 
This is just a best guess based on past experience. There is always the possibility that you could still have some other issue.
 
Random failures easily induce us to create myths to explain them.
Your experience may be entirely a coincidence but even if there is some rational basis the question is irrelevant and a waste of time thinking about.

Just split the database. It isn't difficult. You are lucky that you have not experienced a catastrophic corruption already.
 
One more thing, besides splitting the database. If you use this code:

DoCmd.GoToRecord , , acNewRec

you should also test to see if you are already on a new record because it will give you an error if you are already on a new record and you try to run that code. So the code would be changed to:

Code:
If Not Me.NewRecord Then
   DoCmd.GoToRecord , , acNewRec
End If
 
What version do you find that behavior in, Bob? In v2003, working on a new record and executing

DoCmd.GoToRecord , , acNewRec

merely saves the current new record and moves to a blank new record without popping any error.
 
What version do you find that behavior in, Bob? In v2003, working on a new record and executing

DoCmd.GoToRecord , , acNewRec

merely saves the current new record and moves to a blank new record without popping any error.

Please! Help a newbie. A teacher here wants just this to happen:

1. When users click to go to a form, a new record is made

Where do I paste this code?

button/Properties/??
 

Users who are viewing this thread

Back
Top Bottom