Add New record with split forms

GaelicFatboy

Registered User.
Local time
Today, 06:36
Joined
Apr 17, 2007
Messages
100
Hi everyone,

I have a split form which is used to manage accounts using name, password, account type etc. As the database will be used by people who will have no experience of them I’ve added a command button to add a new record instead of clicking the asterix in the datasheet portion of the form. The code behind the command button is:

Me.Recordset.AddNew
Me.UserName.SetFocus

What’s going wrong is if the user clicks away from the new record or the last field is filled in the new record appears twice in the datasheet and needs to be refreshed with the following code before it appears correctly:

Me.RecordSource = "Accounts_Frmqry"

The process when using the AddNew command does not follow that of when the asterix is clicked to add a new record. The problem is I’m unable to run the refresh code automatically.

What code can I write to overcome this bug in the software?

Cheers

D
 
the trouble is clicking the new record button goes to the new record, irrespective of the entry status of the current record. you generally have some validation in the forms beforeupdate event to make sure everything is properly entered - which would then cause the move to new record to fail

I think maybe

runcommand accmdrecordsgotonew is better syntax than yours,
yours may work fine, but the way you describe it, it probably isnt the correct command

you can also set certain fields as "required" and "cannot be zero length" - which also prevents users savingpartially entered records.

The thing is, databases "sound" easy to use, but in practice we have to write great chunks of code preventing users doing silly things, and generating suitable error messages to keep users informed. eg checking for blank fields, silly values, dates out of range, and so on.
 
Cheers,

That ran sweet as a nut, see it's easy when you know how.

Thanks for that.

D
 

Users who are viewing this thread

Back
Top Bottom