Saving Records

Hi all,

I have a form, which when opened, opens as a filtered form. I use this form as an imput form. I also have a save button which saves the record into the table.

I was wondering what additional VBA coding i would have to attach to the save routine so that the record is saved, disappears from the form and the next empty record (ready for input) appears in the same filtered form.

Thanks
PipMicAsked:
Who is Participating?
 
Rey Obrero (Capricorn1)Commented:
after saving the record, try

docmd.gotorecord,,acnewrec

don't know the status of the form at this point, so you may also need

me.allowadditions=true

and this (most probaly not)
 me.dataentry=true
0
 
Jeffrey CoachmanMIS LiasonCommented:
<I have a form, which when opened, opens as a filtered form. I use this form as an imput form.>
Normally this is not the case because this may cause confusion if the record you are entering is not in the filtered set.
Can you explain the logic behind this?

<I was wondering what additional VBA coding i would have to attach to the save routine so that the record is saved>
This is done automatically, whether or not the data entry property is set.

FWIW, doing things like this tend to makes the interface more complex that it may need to be.
Anytime you "Fight" Access' default functionality, you sometimes end up tying yourself in knots.

If you want total control over the way data is entered, then go with an unbound form.

JeffCoachman



0
 
PipMicAuthor Commented:
hi,

just realised that its early morning in your place, so thanks for your comments.

Regards the logic:

I have a user who is entering data and what I have is an input form in "filtered mode". In other words, the user can only see an empty form. I have had unfiltered forms in the past when users have accidently over written in existing data.

Therefore the reason for the unfiltered form is to avoid accidental overwrites.

I would be grateful to know if there is a better or alternate way of doing this.

I am always willing to learn.
0
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

 
PipMicAuthor Commented:
Hi capricorn,

Tried your code and it didnt work.

Attached it to the save button but no joy!
Attached it to form AfterUpdate event but no joy!

Grateful for additional help.
0
 
Jeffrey CoachmanMIS LiasonCommented:
<I have a user who is entering data and what I have is an input form in "filtered mode". >
Then we seem to have a terminology issue here, because that' is not "Filtered", ...that is "Data Entry mode".

"Filtering" says that you only want to see a subset of the data:
Only USA Orders
Only Orders from Customer 123
Only NY Orders from Customer 123
All Order except Bulgaria
Orders between Jan1 2011 and Feb 15 2011.

What you are asking for is simple called "Data Entry Mode"
Where a user can only see the records they are entering

You can do this by setting the Data Entry property to Yes as capricorn1 stated.

So points to capricrn1

JeffCoachman
0
 
PipMicAuthor Commented:
Hi,

Thanks.

Perhaps I'm using the idea of Filtering incorrectly, however i thought this would be a cute way of preventing the user to accidentally ovewrite data.

The basic problem I was having was that whilst the save button did indeed save the record, and the form then returned to entry "mode", i.e. ready for input, if i clicked on my delete button it would tell me that I was going to delete the record, even though it did not appear on screen.

My recourse is now to remove the delete button  and create a button which will reset the fields to null, so that in the event that the user decides to forego the data he/she is entering he/she can reset the fields to null.

My apologies if my terminology is incorrect.
0
 
Rey Obrero (Capricorn1)Commented:
<Tried your code and it didnt work.>

if you will read the entire post at http:#a:35323553, there are some unknown factors, so the first code is not an outright solution.


if you want a cancel button, you can place this codes in the click event

me.undo

that will clear the form.
0
 
PipMicAuthor Commented:
hi Capricorn,

Used: docmd.gotorecord,,acnewrec

and then created a reset button and it works.
0
 
PipMicAuthor Commented:
Provided good advice
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.