Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms / May 2007

Tip: Looking for answers? Try searching our database.

Exit form without adding a record

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JR Brown - 04 May 2007 18:58 GMT
I have a form "Info" which has a default field filled in "=date()" when I
click the exit button it adds another record but everything is blank except
the autonumber and the date field.  this also happens when I hit the clear
fields button.

Here is the code for the exit button...
      DoCmd.Close acForm, "Info"

and for the clear fields button...
   cboDate = Date
   txtName = Null
   txtZipCode = Null
   cboBranch = Null
   txtPhone = Null
   txtEmail = Null
   cboContactMethod = Null
   cboBest = Null

I am trying to make it so it does not add a new record when these buttons
are hit.  Thanks for your suggestions in advance!
Rick Brandt - 04 May 2007 19:37 GMT
> I have a form "Info" which has a default field filled in "=date()"
> when I click the exit button it adds another record but everything is
[quoted text clipped - 16 lines]
> I am trying to make it so it does not add a new record when these
> buttons are hit.  Thanks for your suggestions in advance!

A default value on a field will NOT cause a record to be created. However
code that sets the value of any control (even to a null) WILL cause a record
to be started and that record will try to save when you leave the record or
close the form.

Your "Clear" button should just issue an Undo on the form rather that
setting values on all the controls.  If you see this happen even when you
don't use the clear button then you have code some place else that is
setting a value.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

JR Brown - 04 May 2007 20:08 GMT
> > I have a form "Info" which has a default field filled in "=date()"
> > when I click the exit button it adds another record but everything is
[quoted text clipped - 26 lines]
> don't use the clear button then you have code some place else that is
> setting a value.

so what about the exit button that adds a record?
Rick Brandt - 04 May 2007 21:27 GMT
> so what about the exit button that adds a record?

Exiting the form *in any fashion* will save the current record if it has
been dirtied.

If you are saying that all a user has to do is navigate to the new record
position, press your Exit button, and this is writing a record to the table
then you must have some code or a macro that is dirtying the record.  You
need to eliminate that.

Signature

Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt   at   Hunter   dot   com

John W. Vinson - 04 May 2007 22:33 GMT
>I am trying to make it so it does not add a new record when these buttons
>are hit.  Thanks for your suggestions in advance!

Add a line

Me.Undo

            John W. Vinson [MVP]
JR Brown - 04 May 2007 23:54 GMT
Thanks for all your Help Guys!!

> >I am trying to make it so it does not add a new record when these buttons
> >are hit.  Thanks for your suggestions in advance!
[quoted text clipped - 4 lines]
>
>              John W. Vinson [MVP]
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.