João serras-pereira
asked on
bound form does not add records
On my app I have a form that pops up, aks for some data, computes, and should insert a new record in the DB. One of the things it does is to compute a new key, and the key is alright.
The situation is that the form is bound to a table, and on the properties is does allow only for "add records" (no Edits and no Deleets).
But in result is only editing the last record and never adding a new record,
Can anyone help?
The situation is that the form is bound to a table, and on the properties is does allow only for "add records" (no Edits and no Deleets).
But in result is only editing the last record and never adding a new record,
Can anyone help?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
ha! Ok I thought that when the form is bound I should not use rs.addnew
I am pasting it back (the form was unboud before...)
I am pasting it back (the form was unboud before...)
ASKER
or can I use:
DoCmd.GoToRecord , , acNext ?
DoCmd.GoToRecord , , acNext ?
When you use the OpenForm method, one of the options is to open in Add mode. If you do that, the form will open to a new record. NO CODE required. No need to permanently set the Data Entry property to yes.
PS - That isn't even close to being the full code.
1. We don't know what form is running the code
2. You didn't post the LogMe function.
3. You don't seem to have any code in the form's BeforeUpdate event so you are not properly validating the new record.
PS - That isn't even close to being the full code.
1. We don't know what form is running the code
2. You didn't post the LogMe function.
3. You don't seem to have any code in the form's BeforeUpdate event so you are not properly validating the new record.
acNewRec it will be.
ASKER
Hi.
It runs (well close as now it always create a blank record :()
and Patwas right - it was not the full code, but (currently) almost all. I have just a bit of preparing code on the "on load" event" but it is unrelated - well it was. Now I have the DoCmd.GoToRecord , , acNewRec there and that's why I always getting a blank record.
... I'll find a way out...
It runs (well close as now it always create a blank record :()
and Patwas right - it was not the full code, but (currently) almost all. I have just a bit of preparing code on the "on load" event" but it is unrelated - well it was. Now I have the DoCmd.GoToRecord , , acNewRec there and that's why I always getting a blank record.
... I'll find a way out...
ASKER
well ... sigh
I need to reopon the case. It's not working again!
I need to reopon the case. It's not working again!
Perhaps it is time for a relaxing moment doing something else.
ASKER
I did!
tomorrow is another day!
tomorrow is another day!
Now I have the DoCmd.GoToRecord , , acNewRec there and that's why I always getting a blank record.Change the way you are opening the form and you won't have to force it to go to a new record.
... I'll find a way out...
ASKER
Open in new window