I searched Google on the message and I think I narrowed it down to the fact that SEMITAREFNBR was a number field and the code was for a text field so I changed the code to another field which is a text field but now I get the form opening with a blank record. here is my code: Private Sub cmdopenrecord_Click() On Error GoTo Err_cmdopenrecord_Click Dim strVRM As String 'set strVRM equal to the selected value before closing the form, otherwise it will give us an error strVRM = Me.VRM.Value Forms!frmMain!SubForm1.SourceObject = "semitavehicle" Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [semita] WHERE [VRM] = '" & strVRM & "'"
Exit_cmdopenrecord_Click: Exit Sub
Err_cmdopenrecord_Click: MsgBox Err.Description Resume Exit_cmdopenrecord_Click End Sub
Any help would be appreciated. Thanks Tony
"Tony Williams" wrote:
[Quoted Text] > I have a search form that is in continuos forms format. I select a record and > click on a command button to open another form showing the data that I've > picked.At least that's what should happen. However when I click on the button > I get a message that says " You cancelled the previous transaction" Can > anyone help me with this code? > > Private Sub cmdopenrecord_Click() > On Error GoTo Err_cmdopenrecord_Click > Dim strsemitarefnbr As String > 'set strSEMITAREFNbr equal to the selected value before closing the > form, otherwise it will give us an error > strsemitarefnbr = Me.SEMITAREFNbr.Value > > Forms!frmMain!SubForm1.SourceObject = "semitavehicle" > Forms!frmMain!SubForm1.Form.RecordSource = "SELECT * FROM [semita] WHERE > [SEMITAREFNbr] = '" & strsemitarefnbr & "'" > > Exit_cmdopenrecord_Click: > Exit Sub > > Err_cmdopenrecord_Click: > MsgBox Err.Description > Resume Exit_cmdopenrecord_Click > > End Sub > > > Thank you > Tony
|