Question Code Error when load data from server (1 Viewer)

n3wguys

Registered User.
Local time
Today, 08:58
Joined
May 14, 2012
Messages
39
Dear All,

I faced something error that my self don't know how to fix it.:banghead:
Im using ms access 2010 and this program compatible with previously ms access.

the error show is type mismatch (error 13) on
Code:
----------------------------
 
Set rbs = CurrentDb.OpenRecordset("SELECT MSysObjects.Name" _
    & " FROM MSysObjects WHERE MSysObjects.Type= 1 And MSysObjects.Flags=0" _
    & " and MSysObjects.Name='" & n_tb & "'")
-------------------------------------
and here I attached the file.

Wish you help me

thanks for coming
 

Attachments

  • realagHRD 2014.zip
    39.6 KB · Views: 69
Last edited:

CJ_London

Super Moderator
Staff member
Local time
Today, 16:58
Joined
Feb 19, 2013
Messages
16,665
For the future, please show all the code related to this error rather than just the single line and it would be extemely helpful if you explained where to go to find the code and what you have to do to run it

I was eventually able to work it out - you have not declared rbs properly, you have references for dao and adodb recordsets but have not declared here which type you want. Try

Dim rbs As DAO.Recordset
 

n3wguys

Registered User.
Local time
Today, 08:58
Joined
May 14, 2012
Messages
39
Solved(Re: Code Error when load data from server)

Dear CJ_London,

Thank you so much that your suggest...yes, you're right..but previously code I have declare is rbs as Recordset

code function is here:
Code:
-----------------------------------------------------------------
Function hp_tb(n_tb)
Dim rbs As Recordset
Dim db As DAO.Database


    Set rbs = CurrentDb.OpenRecordset("SELECT MSysObjects.Name" _
    & " FROM MSysObjects WHERE MSysObjects.Type= 1 and MSysObjects.Flags=0" _
    & " and MSysObjects.Name=  '" & n_tb & "'") 
    
     If Not rbs.EOF Then 
        Set db = CurrentDb 
        db.TableDefs.Delete n_tb 
        db.Close
        Set db = Nothing
    End If
    rbs.Close
    Set rbs = Nothing
        
End Function
----------------------------------------------------------------

I need more time I reach what happen on my code..
and mistake I found is not I include the reference
"Microsoft office14.0 Access Database Engine Object Library".

if this reference have submit, of course I needn't again other reference such as : DAO3.6 Library,Html Library,Microsoft ActiveX Data Object 2.1 Library.

and now, I think this is solved.

Thank you CJ_London..
 
Last edited:

Users who are viewing this thread

Top Bottom