473,748 Members | 7,118 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to solve "runtime error 13: type mismatch"?

1 New Member
Hello,

VBA gives an error on the indicated line. "tblparamet ers" is a database which exists.

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2.  
  3. Option Explicit
  4.  
  5. Sub fill_parameters()
  6.  
  7. Dim rstfill As Recordset
  8. Dim DB2 As Database
  9.  
  10. Set DB2 = CurrentDb
  11. ====> Set rstfill = DB2.OpenRecordset("tblparameters")
  12.  
  13. With rstfill
  14.  
  15. While Not .EOF
  16.  
  17. Forms("frminput")!Txtchoisirleparam.SetFocus
  18. If Forms("frminput")!Txtchoisirleparam.Text = rstfill![Reference] Then
  19.  
  20. Forms("frminput")!Txttauxactua.SetFocus
  21. Forms("frminput")!Txttauxactua.Text = rstfill![taux d'actualisation]
  22.  
  23. Forms("frminput")!Txttauxinfla.SetFocus
  24. Forms("frminput")!Txttauxinfla.Text = rstfill![inflation]
  25.  
  26. Forms("frminput")!TxtDDC.SetFocus
  27. Forms("frminput")!TxtDDC.Text = rstfill![DDC]
  28.  
  29. Forms("frminput")!Txtageretraiteroulant.SetFocus
  30. Forms("frminput")!Txtageretraiteroulant.Text = rstfill![age retraite roulant]
  31.  
  32. Forms("frminput")!Txtageretraitenonroulant.SetFocus
  33. Forms("frminput")!Txtageretraitenonroulant.Text = rstfill![age retraite non-roulant]
  34.  
  35. Forms("frminput")!Txttest.SetFocus
  36. Forms("frminput")!Txttest.Text = rstfill![test]
  37.  
  38. Forms("frminput")!Txttestid.SetFocus
  39. Forms("frminput")!Txttestid.Text = rstfill![testID]
  40.  
  41. Forms("frminput")!Txtfileinput.SetFocus
  42. Forms("frminput")!Txtfileinput.Text = rstfill![input file]
  43.  
  44. Forms("frminput")!Txtfileoutput.SetFocus
  45. Forms("frminput")!Txtfileoutput.Text = rstfill![output file]
  46.  
  47. Forms("frminput")!Txtfileoutputtest.SetFocus
  48. Forms("frminput")!Txtfileoutputtest.Text = rstfill![output test]
  49.  
  50. Forms("frminput")!Txtfileoutputtotal.SetFocus
  51. Forms("frminput")!Txtfileoutputtotal.Text = rstfill![output file total]
  52.  
  53. End If
  54.  
  55. rstfill.MoveNext
  56.  
  57. Wend
  58. End With
  59.  
  60. End Sub
  61.  
Can someone solve this problem?

Thanks
Nov 18 '09 #1
1 4042
MikeTheBike
639 Recognized Expert Contributor
Hi

I assume that you have the ADO library above the DAO library in the references list, so I suggest explicitly dimensioning you variable i.e.

Dim rstfill As DAO.Recordset
Dim DB2 As DAO.Database

HTH


MTB
Nov 19 '09 #2

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

Similar topics

2
2927
by: Stephen Briley | last post by:
For some reason, my posts are scrubbed as attachments. Lets hope that sending from the yahoo account works. I'm new to Python and I'm trying to do some database work with MS Access, but I can't seem to get around a "datatype mismatch error". Here's an example table that I'm working with... ID name dept 1 steve acct
1
6663
by: Snake Djip | last post by:
Hi, I have a problem with a home-made DLL used in an ASP environment. It is coded in VB6, apartment-threaded. The DLL returns a binary PNG stream (an image). I use it with ASP's Response.BinaryWrite to display a dynamic image on a web page. The server is Windows 2000 SP4.
7
38021
by: John | last post by:
Hi Everyone, I'm having this extremely annoying problem with Internet Explorer 6, giving me an error message saying "unknown runtime error" whenever I try to alter the contents of a <divelement using innerHTML. Now, I've researched this problem on the web, and found many references to it, but none of them quite addressed my specific situation, and since my experience with JavaScript is limited, I was not able to adapt the solutions I...
1
3076
by: ApexData | last post by:
Access2k I WAS getting the following error when using the MID function: Run Time Error '13' Type Mismatch I have a new single form, unbound with 1-button on it that uses the following code: Private Sub Command0_Click() MsgBox MID("ABCDEFG", 1, 1)
1
1921
by: rocksoft | last post by:
Hi, i got error "class not registered" when i try to create web setup and deployment project to my web application. i'm used Asp.net and c# to my application, i created web setup and deployment project many times to my application, but i getting this error now.please anybody try to help me out, if anybody solve this problem really million thanks to them. Thanks.
17
5069
imrosie
by: imrosie | last post by:
I've tried this string to Sum up payments, moving brackets and paren's different ways, I still get error 'type mismatch'....not sure why. Can anyone point me in the right direction?? thanks LineTotal: Sum(CLng(**(1-)*100)/100) Rosie
3
2523
by: bxscikid | last post by:
I am using VB 6 in order to clear a listbox (lststuff) containing material entered by the user via input boxes. I am trying to utilize a command button which will clear the list for the user. When testing the program, as soon as i click on the command button I receive a "Type mismatch" error. How can I solve this? This is the code I am using: Private Sub cmdclear_Click(Index As Integer) Dim warning As String warning =...
1
2626
by: technod | last post by:
Hi, The error I am describing occurs with the script I've pasted below. It's a validator for form fields and prints a message into a span tag located beside the empty input tag. I have hard coded the error message to be printed in a specific span tag for testing. --> "<span id="name">www</span>" When this span tag is positioned BEFORE the input tag it works fine but when I place it after (which is the layout I want) it stops working...
2
5593
DonRayner
by: DonRayner | last post by:
This one has me stumped. I'm getting a "Type Mismatch" error on one of my forms when it's being opened. It's hapening before the forms "On Open" event, I stuck a msgbox in there to check and I'm getting the error before it opens. The line of code that calls the form from another form is. DoCmd.OpenForm "NonConformanceAdd",,,,acFormAdd,acDialog I get the error, click ok, then the form opens and works exactly how it's supposed to. I even...
0
8823
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9530
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9363
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9312
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9238
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4864
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3300
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.