Did you see that I tried to reproduce the error you describe and no new ID is generated?
Did you see that I tried to reproduce the error you describe and no new ID is generated?
Even I think you are not able to express my seld properly...
1. The Issue is not about the records saving after clicking the save button - "It is working all fine..."
2. The issue i about the search button..
3. After searching, The details u use to search also take new id and save in the DB after clicking the "Add record" button....
Still Cant understand
Ok . . .
Tell me step by step what to do.
1. Once Click on the "Add new" button.
2. Put the date and agent name.....
3. As soon as you choose a date, a new ID is generated..."remember this id"
4. Now click search... you will get the result...
5. Now again click on "add new"....
6. Now go to the data table and click "refresh all".... you will find the ID there even if you dint save it ....
@Robeen... need help, I mentioned the Step by Step procedure...
Sorry Hitesh. I didn't check the forum over the weekend. I'll work on it this morning & let you know.
When I do Step 4 - I get no record.
The first three steps worked just as you said.
Step 4 shows no record - just a blank (ID = 'New') record.
In Step 5 - when I clicked 'Add Record' - I was not surprised that Access saved the record I was on.
Even if you go to an old [previously existing] record on that Form with the Name & Date entered for your 'Add Record' - Access will save the new data that is on the screen.
This is how it is SUPPOSED to work. It is not an error.
If you DON'T want the record that you started entering after 'Add Record' - to be saved - you will have to put a 'Cancel' button on there so that when you navigate to a new - or old record - the new data on the screen will NOT be saved. You have to TELL Access that you do not want to save your changes.
I hope this explains things?
Let me know.
GR8... You understood me
now is there any way that u can add that "cancel" code in the search button itself or add new button..
You CAN put cancel code wherever you want.
BUT . . .
You should not add code for 'Cancel' to either the 'Search' or 'Add New' buttons.
Those buttons should do what they are supposed to do.
Once you click 'Add New' to add a record, you should either complete adding the record - or Cancel [delete the record you were about to add and do not save it to the database.
You should add a 'Cancel' button to your Form - so that if you decide NOT to add the record you started entering after you clicked Add New, then you can click the Cancel button and that record will not be added.
When you add a new Command Button to the Form - Access will prompt you for what kind of button you want to add.
You can choose 'Record Operations' and 'Cancel' & you will automatically have your Cancel button.
Don't complicate your Form by putting contradictory code in your buttons [like putting code to Cancel -> in the Add New button]. This will create problems.
It will be like putting the brake and accelerator into the same pedal in a car.
You CAN do it . . . it might make a good practical joke . . . a nice little 'dhoka'!!
Hi Hitesh!
Were you able to solve this?
I also noticed another post you had yesterday. Did you get some help with that?
Let me know if you didn't & I'll look at it.
i did i robeen i did it mast.....
I am at home right now/.. will go to office tomorrow and paste the Database so you see it