By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,960 Members | 1,026 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,960 IT Pros & Developers. It's quick & easy.

Add new record, requery to add to table and then open for returning to new record

P: n/a
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

Nov 13 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

Nov 13 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.