You didn't say what was on the frmcontactnote, but in the Open event, you should have: Dim ID As Integer ID = Forms!Form4.OpenArgs 'this is the argument you passed to the form
DoCmd.GoToControl "yourclientID" 'your control name DoCmd.FindRecord ID, , True, , True, , True
Damon
"sue gray" <suegray[ at ]discussions.microsoft.com> wrote in message news:7055AF93-EDD5-48C2-B156-47D2B27FC3ED[ at ]microsoft.com...
[Quoted Text] >I have a command button on a form that I am trying to use to open a blank > form based upon clientid. When I test the form and use the command button > it > brings up all the notes for all clients. > > Private Sub cmdAddContactNote_Click() > ' This code adds a new contact note based on client id. > On Error GoTo Err_cmdAddContactNote_Click > > Dim strDocName As String > > strDocName = "frmcontactnote" > > ' Open Contact Note form in data entry mode and store ClientID in > ' the form's OpenArgs property. > > DoCmd.OpenForm strDocName, , , , acAdd, , Me!clientid > > If IsNull(Forms!frmcontactnote!clientid) Then > Forms!frmcontactnote!clientid = Me!clientid > Forms!frmcontactnote!ContactType.SetFocus > > End If > > > Exit_cmdAddContactNote_Click: > Exit Sub > > Err_cmdAddContactNote_Click: > MsgBox Err.Description > Resume Exit_cmdAddContactNote_Click > > End Sub > > I have tried to find the mistake, I put msgbox me!clientid after the > docmd. > It shows I have the correct client. > > Thanks for any help > >
|