progressive
Technical User
hello all,
could anyone explain what is wrong in the following code:
when i attempt to open the recordset is produces the error type mismatch. however i can't see why this would be a problem becasue rs is set as a recordset and tblapplicationdetails is a table.
thanks
Private Sub Command33_Click()
Dim rs As Recordset, _
sql As String, _
nSCR As Long, _
nSRF As Long
On Error GoTo Error
'//Discover SCR and SRF numbers from form values;
nSCR = Me.RecordID 'scr number comes from this form - the UID label;
nSRF = Forms!frmtblApplicationDetails.ApplicationID 'srf number comes from open instance of SRF form;
'//Open SRF-SCR linking tables;
Set rs = CurrentDb.OpenRecordset("tblapplicationdetails"
'//Insert srf and scr numbers into new record;
With rs
.AddNew 'add new record
!RecordID = nSCR 'set field value
!ApplicationID = nSRF 'set field value
.Update 'confirm update
End With
Exit Sub
Error:
Debug.Print "Form1.Command8_Click: " & Err.Description
MsgBox ("Form1.Command8_Click: " & Err.Description)
End Sub
could anyone explain what is wrong in the following code:
when i attempt to open the recordset is produces the error type mismatch. however i can't see why this would be a problem becasue rs is set as a recordset and tblapplicationdetails is a table.
thanks
Private Sub Command33_Click()
Dim rs As Recordset, _
sql As String, _
nSCR As Long, _
nSRF As Long
On Error GoTo Error
'//Discover SCR and SRF numbers from form values;
nSCR = Me.RecordID 'scr number comes from this form - the UID label;
nSRF = Forms!frmtblApplicationDetails.ApplicationID 'srf number comes from open instance of SRF form;
'//Open SRF-SCR linking tables;
Set rs = CurrentDb.OpenRecordset("tblapplicationdetails"
'//Insert srf and scr numbers into new record;
With rs
.AddNew 'add new record
!RecordID = nSCR 'set field value
!ApplicationID = nSRF 'set field value
.Update 'confirm update
End With
Exit Sub
Error:
Debug.Print "Form1.Command8_Click: " & Err.Description
MsgBox ("Form1.Command8_Click: " & Err.Description)
End Sub