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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Run Time Error 13 - Help me out

Status
Not open for further replies.

sreda001

Technical User
Feb 15, 2005
1
US
I keep getting a run time error 13 - Type Mismatch in the following code. The line with the : in front is where the error occurs.

Function Create_TestTable1()

Dim rs As Recordset
Dim db As Database

Dim mytable As Recordset
Dim temptable As Recordset

Set db = DBEngine.Workspaces(0).Databases(0)
: Set rs = db.OpenRecordset("IRF820", DB_OPEN_DYNASET)
 
You need to explain what you are trying to do then only someone cn help you.

________________________________________
Zameer Abdulla
Visit Me
A child may not be able to lift too much.
But it can certainly hold a marriage together
 
Hi and welcome to Tek-Tips. To get the best from these forums please read faq222-2244 carefully, as your question is a bit vague.

Have you set the right DAO references in your project?
If you also have references to ADO then you will need to qualify your Recordset object declaration
Have you assigned values to Workspaces(0) and Databases(0)?
Is your connection string OK?
Do you have a table or query called IRF820 in the assigned database?

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
I usually do :
dim rs as adodb.recordset

set rs = new adodb.recordset
set rs= .....
.....
set rs=nothing

But I usually not connect as you do.
 
I'm trying to increment RegionID by 1 per region individually whenever a new site is added in that region(There are 32 regions)

I'm still new to this... what other connections do I need if any... do I have to link anything etc.

I'm also getting this error when I have this code :

Private Sub Form_BeforeUpdate(Cancel As Integer)

Dim q As QueryDef
Dim db As DAO.Database
Dim rs As Recordset
Dim nextID As Integer

If IsNull(Me.RegionID) Then Exit Sub

' Only do lookup for value if this is a new record.
If Me.SiteID <> 0 Then Exit Sub

Set db = CurrentDb()

On Error Resume Next
db.QueryDefs.Delete ("Dynamic_Query")
On Error GoTo 0

Set q = db.CreateQueryDef("Dynamic_Query", "SELECT max " _ & "(SiteID) AS a FROM tblSiteRegistration " _
& "WHERE RegionID = '" & Me.RegionID & "'")
Set rs = q.OpenRecordset()
nextID = rs!a
nextID = nextID + 1

Me.SiteID = nextID

End Sub




Thanx in advance!!
 
Sorry... I mean't that I'm trying to increment SiteID

Thanx!

 
This is the line with the error tho...

Set rs = q.OpenRecordset()



I am totally confused with this!
What am I not doing...?

Thanx again!

 
Fixed it...

All I had to do was change :

Dim rs As Recordset to Dim rs As DAO.Recordset

and it sorted it out!

That's one form sorted!

If I try the same code on another form and change SiteID to [Implementer ID] it gives me this error :

Compile Error: Method or Data Member not found



It's stopping at this line now :

If IsNull(Me.RegionID) Then Exit Sub





Just wondering... am I chatting to myself out here? :eek:)



 
Fixed it...!

Thanx VS24!

No problem VS24, you're welcome!

Yup... talking to myself...

:eek:)
 
Looks like you are! In my post above you will find reference to faq222-2244 which gives guidance on forum usage. Read it carefully to get the best answers. On this occassion you're in the wrong forum and you've tacked onto the end of an unrelated old thread.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Essex Steam UK for steam enthusiasts
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top