Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old November 13th, 2005, 11:41 AM
ThompsonJessical@yahoo.com
Guest
 
Posts: n/a
Default Add new record, requery to add to table and then open for returning to new record

I have a database where I want to add a new record to a form and then
send out an email based on the newly added information. I need to
requery the database so the appropriate information is included in the
database, so I want to add new record, requery once all information is
added.
The code I am currently using is


Dim myID As Variant
Dim rst As Recordset

If Me.Dirty Then
Me.Dirty = False
End If

myID = Me.Member_ID
Me.Refresh
Me.Requery

If IsNull(myID) Then
RunCommand acCmdRecordsGoToNew
Else
Set rs = Me.RecordsetClone
rs.FindFirst Member_ID = myID
If rs.noMatch Then
MsgBox "Member ID is no longer available"
Else
Me.Bookmark = rs.Bookmark
End If
End If

If Not Me.NewRecord Then
rs.Bookmark = Me.Bookmark
rs.MoveNext
If rs.EOF Then
MsgBox "You're at the last record"
End If
End If

Set rs = Nothing



End Sub

  #2  
Old November 13th, 2005, 11:41 AM
Wolf
Guest
 
Posts: n/a
Default Re: Add new record, requery to add to table and then open for returning to new record

Not sure exactly what you're trying to do here, but if you want to make
sure the current record is committed to the database before sending an
e-mail, why not just use;

DoCmd.RunCommand acCmdSaveRecord

This will commit the current record and you won't have to phutz around
with all that recordsetclone, refresh, requery stuff. Just launch
straight into your e-mail routine.

 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles