473,407 Members | 2,306 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,407 software developers and data experts.

Type Mismatch (Run-Time error '13')

Recently upgraded a database from 2007 to 2013 and now a section of VBA code does not want to work. What could be the problem. Code is below

Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdFindNow_Click()
  2.  
  3.     Dim SelectSQL As String
  4.     Dim stDocName As String
  5.     Dim Response
  6.     Dim dbs As Database
  7.     Dim rstqry As Recordset
  8.  
  9.     If IsNull(Me.txtFindString) Then
  10.     Response = MsgBox("No search criteria entered", 32, "Empty Field Caution")
  11.     Me.txtFindString.SetFocus
  12.     Exit Sub
  13.     End If
  14.  
  15.     CurrentDb.QueryDefs("qryLookupModifiableResults").SQL = QryLookupSQL(txtFindString)
  16.  
  17. '    DoCmd.SetWarnings False
  18.  
  19.     Set dbs = CurrentDb
  20.  
  21.     stDocName = "qryLookupModifiableresults"
  22.     Set rstqry = dbs.OpenRecordset(stDocName, dbOpenDynaset)
  23.     If rstqry.RecordCount = 0 Then
  24.     Response = MsgBox("No Records Found", 32, "No Criteria Match Caution")
  25.     Me.txtFindString.SetFocus
  26.     Exit Sub
  27.     End If
  28.  
  29.  
  30.  
  31.  
  32.     Dim frmCustomer As Form_Customer
  33.  
  34.     Set frmCustomer = New Form_Customer
  35.  
  36.     frmCustomer.Caption = "Find Results"
  37.     frmCustomer.RecordSource = "qryLookupModifiableresults"
  38.     frmCustomer.Visible = True
  39.  
  40.     CustomerForms.Add frmCustomer
  41.  
  42.  
  43. '    Dim rs As Object
  44.  
  45. '   Response = MsgBox("Are you sure you want to delete this record?", vbYesNo, "Delete Caution")
  46.  
  47. '    If Response = vbYes Then
  48.  
  49. '         Set rs = Me.Recordset
  50. '         rs.Delete
  51. '         rs.MoveNext
  52. '         If rs.EOF Then rs.MovePrevious
  53.  
  54. '         Me.Refresh
  55.  
  56. '    End If
  57. End Sub
Jul 19 '15 #1
4 1308
jforbes
1,107 Expert 1GB
My guess is the Query qryLookupModifiableresults is missing or there is an error being thrown in QryLookupSQL() (which could amount to the same thing), but it would be a lot easier to guess if you could point out which line the error is happening on.
Jul 20 '15 #2
Code runs perfectly in a non-upgraded database.
Error is apparently on this line

Expand|Select|Wrap|Line Numbers
  1. Set rstqry = dbs.OpenRecordset(stDocName, dbOpenDynaset)
Jul 20 '15 #3
jforbes
1,107 Expert 1GB
Does the Query "qryLookupModifiableresults" exists? If it exists, can you successfully open it?

Line 15 updates the QueryDef for the Query, It's quite possible that it is putting something in the QueryDef that Access can't understand.
Jul 20 '15 #4
madankarmukta
308 256MB
I guess the problem exists with not having the read permission to the newly upgraded DB. If , could post the exact error message you are getting, may guide us to help you.

Is it working for the other user ?
Jul 21 '15 #5

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

Similar topics

5
by: jwa6 | last post by:
I get an runtime error w/ this code If Me!Obj = 5100 Then runtime error 13 type mismatch what is this testing for? IE: 5100 jim
1
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:...
2
by: tiiim | last post by:
hi all i created two textboxes to insert date and a button..i hv this following code for that button..but when i ran error msg shows error like 'runtime error 13' & type mismatch..i hv no idea...
1
by: NarutoFanatic | last post by:
Hi, Im currently updating our email sending functionality of our application. The website is written in classic asp and all codes are really a mess. anyway my problem is that our current process...
10
by: dstorms | last post by:
Hi, I'm trying to create a button on a form that: 1. Takes the ComputerID from the form linked to Table 1, 2. Checks Table 2 for a matching ComputerID, and 3. Opens the query qryEditData, and...
2
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...
1
by: brboga | last post by:
Hello, VBA gives an error on the indicated line. "tblparameters" is a database which exists. Option Compare Database Option Explicit Sub fill_parameters()
8
by: shalskedar | last post by:
For r = 2 To 28 Do While Len(Range("A" & r).Formula) > 0 rs.AddNew rs.Fields(0) = Range("A" & r).Value rs.Fields(1) = Range("C" & r).Value 'Debug.Print r & ":(" & Range("D" & r).Value & ")"...
10
by: Frabker3 | last post by:
I have an Access DB that was originally created in Access 2, then converted to Access '97, and a few years ago converted again, to Access '03. During the convert to '03 it was determined that DAO...
1
by: Shelley Burke | last post by:
Many thanks for the coding provided in an earlier thread to be able to snapshot document, save as pdf and email it. Unfort I have done everything as instructed and am still having problems. ...
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...
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
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.