473,396 Members | 1,724 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.

OpenRecordSet error Type Mismatch! How to solve this?

mutanic
19
Hi everybody, I couldn't identify what is the error...here is my code :

Expand|Select|Wrap|Line Numbers
  1. Public Sub cmdSelRO_Click()
  2. On Error GoTo Err_cmdSelRO_Click
  3.  
  4. Dim dbs As Database
  5. Dim rst As DAO.Recordset
  6. Dim SQL As String
  7.  
  8. SQL = "SELECT * FROM tblSolicitorMonthlyReport WHERE RO = '" & cmbRO.Value & "' ORDER BY RO"
  9. Set dbs = CurrentDb("tblSolicitorMonthlyReport")
  10. Set rst = dbs.OpenRecordset(SQL, dbOpenTable)
  11. rst.MoveLast
  12.  
  13. Exit_cmdSelRO_Click:
  14.     Exit Sub
  15.  
  16. Err_cmdSelRO_Click:
  17.     MsgBox Err.Description
  18.     Resume Exit_cmdSelRO_Click
  19.  
  20. End Sub
Oct 27 '10 #1
6 3954
Mariostg
332 100+
If the value of cmbRO.Value is numeric, remove the single quotes surrouding your query statement.
Oct 27 '10 #2
what is the datatype of RO in the database ?
Oct 27 '10 #3
mutanic
19
Ok, I just change the code into this :

Expand|Select|Wrap|Line Numbers
  1. Public Sub cmdSelRO_Click()
  2. On Error GoTo Err_cmdSelRO_Click
  3.  
  4. Dim dbs As Database
  5. Dim rst As DAO.Recordset
  6. Dim SQL As String
  7.  
  8. 'If txtTitleRecoveryOfficer.Visible = False Then
  9. '    txtTitleSolicitor.Visible = True
  10. 'Else
  11. '    txtTitleRecoveryOfficer.Visible = False
  12. '    txtTitleSolicitor.Visible = True
  13. 'End If
  14.  
  15. Set dbs = CurrentDb()
  16. Set rst = dbs.OpenRecordset("SELECT * FROM tblSolicitorMonthlyReport WHERE RO = '" & cmbRO.Value & "' ORDER BY RO", dbOpenDynaset)
  17. rst.MoveLast
  18.  
  19. Exit_cmdSelRO_Click:
  20.     Exit Sub
  21.  
  22. Err_cmdSelRO_Click:
  23.     MsgBox Err.Description
  24.     Resume Exit_cmdSelRO_Click
  25.  
  26. End Sub
but nothing happen...??? I wanted to change the recordset inside my form base on my selection... I select any "Recovery Officer" name from dropdownlist and it suppose to change my current recordset which it only contain data related to selected name. How do I solve this???
Oct 27 '10 #4
mutanic
19
Data type of RO is "Text" only...

I got list of "Recovery Officer" inside table tblRO which is connected to tblSolicitorMonthlyReport as it would appear as dropdownlist when you open in table mode.

Now I got this button in form which also contain list of "Recovery Officer" as dropdownlist, I select the name then I want my form recordset contain related data to the selected name. How do I do this?
Oct 27 '10 #5
Mariostg
332 100+
Not sure I see clearly what you try to achieve. But if you want to change the content of your form when the combo content change, the form has to know the dataset has changed.

So on an On update event of the combo box, you want something like
Expand|Select|Wrap|Line Numbers
  1. MyForm.Recordsource=YourSqlQuery
  2.  
Oct 27 '10 #6
try cmbRO.text instead of cmbRO.Value
Oct 28 '10 #7

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

Similar topics

4
by: Mike | last post by:
I am getting a type mismatch error when I do a bulk insert. ---Begin Error Msg--- Server: Msg 4864, Level 16, State 1, Line 1 Bulk insert data conversion error (type mismatch) for row 1, column...
1
by: Sunil Korah | last post by:
I am having some trouble with opening recordsets. I have used code more or less straight from the access help. But still I am getting some errors. I am unable to work out what exactly I am doing...
6
by: isaac2004 | last post by:
hello i am getting a type mismatch for a page i am trying to write. any help would be great source code <%@ Language=VBScript %> <% Option Explicit %> <!--#include...
6
by: foster99 | last post by:
Hi guys, Im trying to create a page using SQL and ASP. The SQL was working correctly untill I tried to introduce the use of variables so that I could grab two variables from two text boxes, and...
1
by: makinha | last post by:
Hello, I got a type mismatch error on my script when compare the null value collect from the sql server. From the beginning, I code as below: <% If (rst_rs("Amount"))="" then %> Sorry the...
1
by: nckinfutz | last post by:
hello, I am having a problem with an access database. this is not my database and I did not create it, nor am I very good at access. however, I am a network engineer and that is why this problem...
1
nurikoAnna
by: nurikoAnna | last post by:
I am having troubled debugging with my codes...It always gets an error "TYPE MISMATCH" Below is my code in my frmApplicantsEntry: ...
1
nurikoAnna
by: nurikoAnna | last post by:
I am having troubled debugging with my codes...It always gets an error "TYPE MISMATCH" Below is my code in my frmApplicantsEntry: __________________________________________________...
2
by: sknaina | last post by:
My project is based on a2003adp with sql2000 srv. Over there i want to control input validity check via Sp and VBA. That's why I write the following Stoted Proc as well as VBA Function and Procedure...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
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...
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.