473,503 Members | 5,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Access 2003 + Type mismatch issue

1 New Member
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 has ended up in my lap i guess.

This is the issue: There is an access database that pulls data from a list of excel spread sheets. This access database and excel files are stored on a server. When the database requests info from the excel file and tries to import it from the spread sheet, there is a 'type mismatch' error.

Nowthen, if i log on to the database with admin rights, the request works, but if I log on as a user, It doesnt work and I get this mismatch error. However, I have checked all the permissions for the database and folders (etc.) and that all looks fine.

Below is the code with what the creator highlighted as where he thought was the problem existed

Expand|Select|Wrap|Line Numbers
  1. Private Sub BatchNum_AfterUpdate()
  2. On Error GoTo Err_BatchNum_AfterUpdate
  3.  
  4.     Dim strBatchNum As String
  5.     Dim strFilter As String
  6.     Dim sPath As String
  7.     Dim lngFlags As Long
  8.     Dim varFileName As Variant
  9.     Dim objXLApp As Excel.Application
  10.     Dim objXLBook As Excel.Workbook
  11.     Dim objDataSheet As Excel.Worksheet
  12.     Dim objCell As Excel.Range
  13.  
  14.         strBatchNum = Right(Me.BatchNum, 4)
  15.         strFilter = "Excel Files (*.xls)" & vbNullChar & "*" & strBatchNum & "*.xls"
  16.  
  17.  
  18.  
  19.         lngFlags = tscFNPathMustExist Or tscFNFileMustExist Or tscFNHideReadOnly
  20.  
  21.     varFileName = tsGetFileFromUser( _
  22.     fOpenFile:=True, _
  23.     strFilter:=strFilter, _
  24.     rlngflags:=lngFlags, _
  25.     strDialogTitle:="Find File (Select The File And Click The Open Button)")
  26.  
  27.     If IsNull(varFileName) Or varFileName = "" Then
  28.  
  29.         MsgBox "File selection was canceled.", vbInformation
  30.  
  31.         Exit Sub
  32.     Else
  33.  
  34.         Me.tbfile = varFileName
  35.         Set objXLBook = GetObject(varFileName)  --------Generates error "Type Mismatch"        
  36.  
  37. Set objXLApp = objXLBook.Parent
  38.  
  39.         Set objDataSheet = objXLBook.ActiveSheet
  40.         Set objCell = objDataSheet.Range("A8")
  41.         objCell.FormulaR1C1 = "=AVERAGE(R[-6]C:R[-1]C)"
  42.         Me.Viscosity = objCell.Value
  43.         Set objCell = objDataSheet.Range("B8")
  44.         objCell.FormulaR1C1 = "=AVERAGE(R[-6]C:R[-1]C)"
  45.         Me.Speed = objCell.Value
  46.         Set objCell = objDataSheet.Range("F8")
  47.         objCell.FormulaR1C1 = "=AVERAGE(R[-6]C:R[-1]C)"
  48.         Me.Temp = objCell.Value
  49.         Set objCell = objDataSheet.Range("H7")
  50.  
  51.             Select Case objCell.Value
  52.                 Case "T-D"
  53.                     Me.Spindle = "94"
  54.                 Case "T-A"
  55.                     Me.Spindle = "91"
  56.             End Select
  57.     End If
  58.     Me.Analyst.SetFocus
  59.  
  60. Exit_BatchNum_AfterUpdate:
  61.     Exit Sub
  62. Err_BatchNum_AfterUpdate:
  63.     MsgBox Err.Description
  64.     Resume Exit_BatchNum_AfterUpdate
  65.  
  66. End Sub
  67.  
  68.  
thanks for your help, hope this is enough info.
Oct 17 '08 #1
1 2802
DonRayner
489 Recognized Expert Contributor
It looks like you have at least one outside function there "tsGetFileFromUser" This function is what is setting the variable that is used in the the line that you are getting your error on. The users might not have the correct permissions for whatever module the function is stored in.

Try putting a message box call just before that line to see what the variable is set to. If it's not returning what was selected then you probally have a problem with the function.
Expand|Select|Wrap|Line Numbers
  1. msgbox varFileName
  2.  
As long as you are running a full version of Access you can find out for sure the line that the code is crashing on by commenting out the "on error" line in the code. When it's run without the "on error" it will crash to the debug screen and hi-lite the exact line causing the error.
Oct 18 '08 #2

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

Similar topics

2
2915
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...
2
2098
by: Steve Briley | last post by:
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... ...
11
3733
by: Wolfgang Kaml | last post by:
Hello All, I have been working on this for almost a week now and I haven't anything up my sleeves anymore that I could test in addition or change.... Since I am not sure, if this is a Windows...
6
4712
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much...
2
1904
by: Giulio | last post by:
I make an import of a huge file txt table with headers at each page and date format as "20.12.2004" in order to use the data I first qo a query that exclude all line representing the headers...
1
3632
by: j.mandala | last post by:
I created a simple link between two tables in a query. TableA has Social Security numbers stored as Long Integer Data. (I imported this table). The Join is between these two fields Table ...
2
5150
by: Jim H | last post by:
I'm trying to get a bunch of records based on client id and a date range. I keep getting an error when I enclose my date string in quotes in the where cleause. The error is: Microsoft JET...
4
1785
by: james | last post by:
I upgraded my 2002 project to 2003 and I am getting several of there errors on my forms xxxForm.resx Resource transformation for file 'xxxForm.resx' failed. Possible Version mismatch. Type...
1
11521
by: webstuff | last post by:
Hi, I'm getting a 'Type mismatch' exception when calling the Word.Application.Documents.Open method when using the Office XP 2003 PIAs. the actual error is: ...
0
7194
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
7070
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
7267
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,...
1
6976
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
7449
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
5566
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,...
1
4993
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...
0
4666
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...
0
1495
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 ...

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.