Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Problem 1

Status
Not open for further replies.

treyball3

Programmer
Jun 20, 2001
74
US
I've used Access before with VB, but it's been awhile. I have this code...

Option Explicit

Private Const gstrPNDB As String = "C:\TestPartNumbers.mdb"

Private Sub cmdProcess_Click()
Dim strSQL As String
Dim strPartNum As String
Dim strDate As String
Dim strInitials As String
Dim dbPartNum As Database
Dim rsNew As Recordset

strSQL = "SELECT * FROM Production WHERE CheckedOut = True ORDER BY PartNumber"

Set dbPartNum = OpenDatabase(gstrPNDB, True)
Set rsNew = dbPartNum.OpenRecordset(strSQL)
...

on the last line, the Set rsNew... I am getting a runtime error 13: type mismatch. Any idea why? I'm sure this should work. CheckedOut in strSQL is a Yes/No field in the access table. Oh, and I do have the correct references included in my project.
 
Hi,

It seemd to me that maybe you are getting a clash between two libraries.

try fully qualifying the dim statement i.e.

dim rs as dao.recordset

I think the type 13 error is internal to VB

Take care

Matt
 
YES! That worked, thank you. I've been starin at that for a couple hours. Thanks again.
Todd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top