Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

confused! records added when form closes...

Status
Not open for further replies.

ProgramError

Programmer
Mar 2, 2005
1,027
GB
I have created two almost identical forms, one created using the wizard and one by dragging the fields from the forms bound field list. The only thing that differs are the layout.

Both forms have identical fields on them. both have identical VBA code associated with them. Both have identical properties.

I close the wizard created form and it adds a record to the bound table.
I close the dragged field list form and it DOES NOT add a record?

Can anyone explain why?

As a matter of interest I want both to NOT add a record to the table when closed.


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
I would take a look at the RecordSource for the forms....

The one created by the wizard would have automatically added the table or query you selected as the basis for the form as the RecordSource.

The one you "dropped" fields on might not have added correctly.

You should also look to the Allow properties for the form. maybe one is not set correctly.

Outside of those, I don't know...good luck.



=======================================
People think it must be fun to be a super genius, but they don't realize how hard it is to put up with all the idiots in the world. (Calvin from Calvin And Hobbs)

Robert L. Johnson III
CCNA, CCDA, MCSA, CNA, Net+, A+, CHDP
VB/Access Programmer
 
For those interested...

It turn out to be a on exit event which caused the problem.
A textbox was given the focus when the form first loaded. But there was a on exit event associated with the textbox which normally changed anything entered to upper case.
As there was nothing entered I mistakenly assumed that nothing would change. If nothing was changed to upper case this still makes the form dirty and elagable as a record entry for saving..
The sub has now been changed to a On Change event and now works as planned.

Hope this helps someoe else.


Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Hey, I've also discovered the dirty flag is set true when you go to a new record for data entry using

docmd.goto ,, acnewrecord

Which in turn caused a new record to be added to the table.

You learn something new every day :)

Ian Mayor (UK)
Program Error
Programming is 1% coding, 50% error checking and 49% sweat as your application bombs out in front of the client.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top