473,396 Members | 1,676 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Run-Time error '13' Type Mismatch on recordsetclone

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
6 6207
MMcCarthy
14,534 Expert Mod 8TB
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
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
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
14,534 Expert Mod 8TB
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
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
14,534 Expert Mod 8TB
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

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

Similar topics

4
by: Ed | last post by:
Hello, I took a course in asp about 2 years ago and I was practicing with IIS 5.0. Then I put it down for a while. Now trying to get back to it. I can't run asp files from subdirectories of...
2
by: Jenna Olson | last post by:
Hi all- I've never seen this particular issue addressed, but was wondering if there's anything to support one way or another. Say I have a class: class ManipulateData { public:...
15
by: mg | last post by:
How can I run an .exe using C# from within the code behind of a WebForm app?
6
by: billr | last post by:
I have developed a small API for taking care of a lot of boiler plate stuff in a multi formed windows application, for example setting up a messaging thread framework. New Forms, in the...
13
by: Bob Day | last post by:
Using vs2003, vb.net I start a thread, giving it a name before start. Code snippet: 'give each thread a unique name (for later identification) Trunk_Thread.Name = "Trunk_0_Thread" ' allow...
9
by: Brett Wesoloski | last post by:
I am new to VS2005. I changed my program.cs file to be a different form I am working on. But when I go to run the application it still brings up the form that was originally declared as new. ...
7
by: Lee Crabtree | last post by:
I remember when I was first getting into .NET Forms programming that there was a rather emphatic rule about not constructing a form before calling Application.Run with it. So this: ...
8
by: David Thielen | last post by:
Hi; In our setup program how do I determine if I need to run "aspnet_regiis –i" and if so, is there an API I can calll rather than finding that program on the user's disk and calling it? --...
3
by: traceable1 | last post by:
Is there a way I can set up a SQL script to run when the instance starts up? SQL Server 2005 SP2 thanks!
7
by: mxdevit | last post by:
Task: run application from ASP.NET for example, you have a button on ASP.NET page, when press this button - one application is invoked. the code to run application (for example, notepad) is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.