borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder

AndreaVB | Forum | News | Downloads | Register | Help | Member List | Statistics | Search | PM | Profile

Print This Topic
Previous Topic (Excel VBA Help Please)Next Topic (how to add message box) New Topic New Poll Post Reply
AndreaVB Forum : VBA (Access, Excel, Word, ...) : Type Mismatch Error
Poster Message
Cam
Level: Guest


icon Type Mismatch Error

Hi,

I've got the following code in Access and it is returning a type mismatch error code on the first line. I'm real new at this and can't figure, I know that by adding the resultset I've created this error, any idea?? ANy help greatly appreciated!

Sub Proc_MacroModuleQueryTest_DONT_USE()
On Error GoTo Proc_MacroModuleQueryTest_DONT_USE_Err

Dim RS As New ADODB.Recordset

Set RS = CurrentDb.OpenRecordset("SELECT Supplier FROM INVUPC;")


    ' This Query Clears the Table POATEST, so that we can obtain data from POA reports specific to DBQ
    DoCmd.OpenQuery "QUERY_CLEARPOATEST", acNormal, acEdit
    ' This Query Appends data specific to DBQ from the table CHP_LOAD_POA_STATUS to POATEST table
    DoCmd.OpenQuery "QUERY_APPENDCHP_LOAD_POA_STATUS", acNormal, acEdit
    ' This Query Appends data specific to DBQ from the table CHP_POA_STATUS to POATEST table
    DoCmd.OpenQuery "QUERY_APPENDCHP_POA_STATUS", acNormal, acEdit
    ' Opens Query INVUPC
    DoCmd.OpenQuery "QUERY_INVALTUPC", acNormal, acEdit
        
    ' Ok, these are all the queries I run to create the tables, but now I want to specify different email
    ' address based on the data for each publisher. For example, in hte test data there are 5 UPC's 1 goes
    ' to Supplier 8303, with email cbotham@indigo.com
    
    If RS!Supplier = "8303" Then
        DoCmd.OpenQuery "copyappending", acNormal, acEdit
        DoCmd.SendObject acTable, "Publisher Data", "MicrosoftExcel(*.xls)", "cbotham@indigo.ca", "", "", "", "", False, ""
    End If
    
    'Will this send only the data from Publisher Data with Supplier 8303, or the whole file?

Proc_MacroModuleQueryTest_DONT_USE_Exit:
    Exit Sub

Proc_MacroModuleQueryTest_DONT_USE_Err:
    MsgBox Error$
    Resume Proc_MacroModuleQueryTest_DONT_USE_Exit

End Sub

13-05-2003 at 06:23 PM
| Quote Reply
~Bean~
Level: VB Guru


Registered: 07-04-2003
Posts: 488
icon Re: Type Mismatch Error

You have Dim'd the RS object as an ADO recordset and then you are using a DAO method to create the recordset by saying...
Set RS = CurrentDb.OpenRecordset("SELECT Supplier FROM INVUPC;")


change your DIM to...

DIM RS As Recordset



____________________________
Eggheads unite! You have nothing to lose but your yolks.

13-05-2003 at 09:53 PM
View Profile Send Email to User Show All Posts Visit Homepage | Quote Reply
AndreaVB Forum : VBA (Access, Excel, Word, ...) : Type Mismatch Error
Previous Topic (Excel VBA Help Please)Next Topic (how to add message box) New Topic New Poll Post Reply
Surf To:


Not Logged In? Username: Password: Lost your password?
Partners: Download Actual Software | Free Software Download
borderAndreaVB free resources for Visual Basic developersborder

borderAndreaVB Visual Basic and VB.NET source code resources - Copyright © 1999-2007 Andrea Tincaniborder