Link to home
Start Free TrialLog in
Avatar of PipMic
PipMicFlag for Gibraltar

asked on

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
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
<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



Avatar of PipMic

ASKER

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.
Avatar of PipMic

ASKER

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.
<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
Avatar of PipMic

ASKER

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.
<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.
Avatar of PipMic

ASKER

hi Capricorn,

Used: docmd.gotorecord,,acnewrec

and then created a reset button and it works.
Avatar of PipMic

ASKER

Provided good advice