Add button to open my form on a blank record

YNWA

Registered User.
Local time
Today, 15:09
Joined
Jun 2, 2009
Messages
905
Hi,

I have a form with a list box on a form called SEARCH showing all patients in my query. When I double click a patient it opens up their record in the MAINFORM.

What I need is a button on form SEARCH so when I click it, it opens the form MAINFORM on a new blank record, ready for the user to input data.

Currently have a Open Form button, but this opens the form showing the first record.

Any ideas?

Thanks
Will
 
I think I cracked it.

Used this and added the part in bold.

Code:
Private Sub cmdAdd_Click()
On Error GoTo Err_cmdAdd_Click
    Dim stDocName As String
    Dim stLinkCriteria As String
    stDocName = "MAIN_FORM_PATIENTS"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    [B]DoCmd.GoToRecord , , acNewRec[/B]

Exit_cmdAdd_Click:
    Exit Sub
Err_cmdAdd_Click:
    MsgBox Err.Description
    Resume Exit_cmdAdd_Click
    
End Sub
 
Why not open the form directly in append mode?
Code:
DoCmd.OpenForm stDocName, , , stLinkCriteria,[B]acFormAdd[/B]
 

Users who are viewing this thread

Back
Top Bottom