By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,456 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,456 IT Pros & Developers. It's quick & easy.

Run-Time error '13' Type Mismatch on recordsetclone

P: 5
I am getting the above message on the below code can someone tell me what I am doing wrong?

Dim Db As dao.Database
Dim Rs As dao.Recordset
Dim Rsfrm As Recordset
Dim crtl As Control

Set Db = CurrentDb
Set Rs = Db.OpenRecordset("TBL_ATU_Daily_Numbers", dbOpenDynaset)
Set Rsfrm = Me!SUBFRM_DAILY_NEW_UPDATED.Form.RecordsetClone

Do Until Rsfrm.EOF

Rs.AddNew
Rs![Work_Day] = Forms!FRM_RESULTS!SUBFRM_DAILY_NEW_UPDATED!TXT_Wor k_Day
Rs![Region] = Forms!FRM_RESULTS!SUBFRM_DAILY_NEW_UPDATED!TXT_Reg ion
Rs![Inc_Type] = Forms!FRM_RESULTS!SUBFRM_DAILY_NEW_UPDATED!TXT_Inc _Type
Rs![Inc_Total] = Forms!FRM_RESULTS!SUBFRM_DAILY_NEW_UPDATED!TXT_Inc _Total
Rs.Update
Rsfrm.MoveNext
Loop
Nov 21 '06 #1
Share this Question
Share on Google+
6 Replies


MMcCarthy
Expert Mod 10K+
P: 14,534
I don't think you can set a recordsetclone on a subform. I could be wrong.

Try setting it on the form rather than the subform object.

Expand|Select|Wrap|Line Numbers
  1. Set Rsfrm = [Forms]![MainFormName]![SUBFRM_DAILY_NEW_UPDATED].Form.RecordsetClone
If that doesn't work try using the Record Source (assuming theres no filters.

Expand|Select|Wrap|Line Numbers
  1. Set Rsfrm = [Forms]![MainFormName]![SUBFRM_DAILY_NEW_UPDATED].Form.RecordSource
You will have to add a Rsfrm.MoveFirst it this does work.

Let me know how you get on.
Nov 21 '06 #2

P: 5
When I try

Set Rsfrm = Forms!FRM_RESULTS!SUBFRM_DAILY_NEW_UPDATED.Form.Re cordsetClone

I get Run-Time error '13' Type Mismatch on recordsetclone

When I try

Set Rsfrm = Forms!FRM_RESULTS!SUBFRM_DAILY_NEW_UPDATED.Form.Re cordSource

I get run-time error '424' Object required.
Nov 21 '06 #3

P: 5
Microsoft website show the syntax as

Set Rsfrm = Forms!FRM_RESULTS!SUBFRM_DAILY_NEW_UPDATED.Records etClone

However, when I execute this I get an Run-Time Error '438' Object doesn't support this property or method.

The code for the form I am trying to get the recordset of looks like this.

Private Sub Form_Load()
With cnnCMS
.Open "Connectionstring"

End With
strSQL = "SELECT Q2.LOAD_DATE, Q2.C_SUBGRP, Q2.C_FLAG , COUNT(Q2.C_CCASE) 'CASES' " & _
"FROM (SELECT DISTINCT Q1.LOAD_DATE, Q1.C_SUBGRP, Q1.C_FLAG, Q1.C_CCASE FROM " & _
"(SELECT convert(varchar,D_PRE_STG_RCLP.LOAD_DT,101) 'LOAD_DATE', D_PRE_STG_RCLP.C_SUBGRP, " & _
"D_PRE_STG_RCLP.C_FLAG, D_PRE_STG_RCLP.C_CCASE FROM D_PRE_STG_RCLP " & _
"WHERE D_PRE_STG_RCLP.LOAD_DT>='" & Forms.FRM_MAIN.Text0 & "' " & _
"AND D_PRE_STG_RCLP.LOAD_DT<='" & Forms.FRM_MAIN.Text1 & "') AS Q1) AS Q2 " & _
"GROUP BY Q2.LOAD_DATE, Q2.C_SUBGRP, Q2.C_FLAG"
With rstCMS
Set .ActiveConnection = cnnCMS
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open strSQL
End With
Set Me.Recordset = rstCMS
Me.TXT_Work_Day.ControlSource = "LOAD_DATE"
Me.TXT_Region.ControlSource = "C_SUBGRP"
Me.TXT_Inc_Type.ControlSource = "C_FLAG"
Me.TXT_Inc_Total.ControlSource = "CASES"

cnnCMS.Close
Set cnnCMS = Nothing
Set rstCMS = Nothing
End Sub
Nov 21 '06 #4

MMcCarthy
Expert Mod 10K+
P: 14,534
Sorry I had to go out for a few hours.


Just had a thought. The name of the subform object is not always the name of the subform.

In the main form design click on the frame surrounding the subform and open the properties window. Under the Other tab look at the value in the Name property.

Is it the same?

If not, go back to your original code with

Set Rsfrm = Me!SubformObjectName.Form.RecordsetClone
Nov 21 '06 #5

P: 5
I checked the tab it list the same name as the form. Other than requery the rs from the subform, can you think of anything that would work?
Nov 21 '06 #6

MMcCarthy
Expert Mod 10K+
P: 14,534
I checked the tab it list the same name as the form. Other than requery the rs from the subform, can you think of anything that would work?
What event are you running this code in and is it from the main form or the subform.
Nov 21 '06 #7

Post your reply

Sign in to post your reply or Sign up for a free account.