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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I create code for a command button that will add 2

Status
Not open for further replies.

kat25

Technical User
Feb 26, 2003
105
US
Hi,
I've got a form that I want to add a command button to that will do the following:
1. open a new record
2. save the record to the fields defined in my table.
3. always show a new record each time the user clicks on the command button.

MY problem is that my command button creates a new record after I save the previous record, however, the next time I
open the form, the 1st record is displayed instead of a
blank new record.

Many thanks for any suggestions.
Kat25
 
Thanks FancyPrairie!
That worked great.

One more question. Now that I have a new record, I want to
type in my values and then send an email using the sendobject method.
My problem is that in my current code, I open the form and then use the sendobject method, however this does not allow my form to remain open long enough for me to type in the values before the sendobject event occurs.

Any thoughts.
Again, thank you.
 
You'll need to be more specific. Are issuing the sendobject command and then closing the form?
 
Yes, I then close the form. My steps are:
open form
sendobject
close form

Thank you.
 
Here is a sampel of code that works fine.

Private Sub cmdEmailClose_Click()

With DoCmd
.SendObject acSendTable, "Shippers", acFormatTXT, "jim.blanchard@tycohealthcare.com", , , "TEST", "BODY", False
.Close
End With

End Sub

Hope this helps.

Jim Hope this helps!

Jim
 
Thank you for your time and help.
I will give that a try.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top