Making form go blank when new Record is called

E

Emma

Hi I have the following code it creates a new record in the database,
unfortunately it isn't wring a blank form to the screen, I'm not sure if this
is realted to may last question acNext, but here's the code anyhow, (I
borrowed it from Klatuu, it worked fine for the purpose he helped me with).

Private Sub newrcd_Click()

Dim intNewID As Integer
Dim strSQL As String

On Error GoTo Err_newrcd_Click

'Find the current high number and Add 1 to it

intNewID = Nz(DMax("[ID]", "[Case Note Client]"), 0) + 1

'Write it to the table ASAP to avoid duplicates in a multi user environment

strSQL = "INSERT INTO [Case Note Client] (ID) SELECT " & _
intNewID & " AS Dummy;"
CurrentDb.Execute strSQL, dbFailOnError

'Make the new record the current record

Me.Requery
With Me.RecordsetClone
.FindFirst "[ID] = " & intNewID
If Not .NoMatch Then
Me.Bookmark = .Bookmark
End If
End With
'Me![Case Worker].Value = CurrentUser

Exit_newrcd_Click:
Exit Sub

Err_newrcd_Click:
MsgBox Err.Description
Resume Exit_newrcd_Click

End Sub
 
K

Klatuu

It is related, Emma. The code I posted previously will create a record with
a value in the [Case Note Client] field and make it the current record.

What is it you are wanting to do?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top