Invalid Reference (Error 13 - Type Mismatch) 
Author Message
 Invalid Reference (Error 13 - Type Mismatch)

Hello,

I recently upgraded from Access 97 to 2000.  The following code
generates a Type mismatch error.  I assumed it was due to an invalid
or missing reference, but I could not find any missing references, and I
have all the VB, DAO, and Object libraries loaded.

Here is the code:

Function fGetCurrentUser() As String
Dim db As Database
Dim rsCU As Recordset
Dim strTable As String

Set db = CurrentDb()
strTable = "tblCurrentUser"
Set rsCU = db.OpenRecordset(strTable)   'Error occurs here

rsCU.MoveFirst
fGetCurrentUser = rsCU!CurrentUser
rsCU.Close

End Function

Thanks,
Joseph Cunningham

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Wed, 29 Jan 2003 03:00:00 GMT  
 Invalid Reference (Error 13 - Type Mismatch)
You don't say where the type mismatch comes from, but I would suggest that
you dimension your db and rec set as:

Dim db as DAO.Database
Dim rsCU as DAO.Recordset
--
Steve Arbaugh
ATTAC Consulting Group
http://ourworld.compuserve.com/homepages/attac-cg/acgsoft.htm

Quote:

> Hello,

> I recently upgraded from Access 97 to 2000.  The following code
> generates a Type mismatch error.  I assumed it was due to an invalid
> or missing reference, but I could not find any missing references, and I
> have all the VB, DAO, and Object libraries loaded.

> Here is the code:

> Function fGetCurrentUser() As String
> Dim db As Database
> Dim rsCU As Recordset
> Dim strTable As String

> Set db = CurrentDb()
> strTable = "tblCurrentUser"
> Set rsCU = db.OpenRecordset(strTable)   'Error occurs here

> rsCU.MoveFirst
> fGetCurrentUser = rsCU!CurrentUser
> rsCU.Close

> End Function

> Thanks,
> Joseph Cunningham

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 29 Jan 2003 03:00:00 GMT  
 Invalid Reference (Error 13 - Type Mismatch)

See if this helps:

The DAO reference looks fine but it is in fact broken.
(But the Broken property will not be True. Go figure.)
Uncheck it, close the window.
Re-open the window and re-check it.
Problem solved.
Problem caused by installation of MDAC 2.5
--
Joe
Access MVP
Check out Dev Ashish's web site for answers to common questions
http://www.mvps.org/access/

Quote:

> Hello,

> I recently upgraded from Access 97 to 2000.  The following code
> generates a Type mismatch error.  I assumed it was due to an invalid
> or missing reference, but I could not find any missing references, and I
> have all the VB, DAO, and Object libraries loaded.

> Here is the code:

> Function fGetCurrentUser() As String
> Dim db As Database
> Dim rsCU As Recordset
> Dim strTable As String

> Set db = CurrentDb()
> strTable = "tblCurrentUser"
> Set rsCU = db.OpenRecordset(strTable)   'Error occurs here

> rsCU.MoveFirst
> fGetCurrentUser = rsCU!CurrentUser
> rsCU.Close

> End Function

> Thanks,
> Joseph Cunningham

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Wed, 29 Jan 2003 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Worked fine yesterday, today I get Error 13 Type Mismatch errors

2. Error 13: Type Mismatch error

3. Type Mismatch Run-Time error 13

4. Type Mismatch Error 13

5. type mismatch error '13'????

6. Using CurrentDB() receives Type Mismatch Error 13

7. Type mismatch, run-time error #13

8. type 13 mismatch error

9. ACC2000:Run Time Error '13': Type Mismatch

10. Run -time error '13' Type Mismatch

11. Run-time error '13': Type mismatch

 

 
Powered by phpBB® Forum Software