Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Data Report Generating error 13 Type Mismatch error what?
Message
From
18/05/2002 19:33:39
 
 
To
All
General information
Forum:
Visual Basic
Category:
Database DAO/RDO/ODBC/ADO
Title:
Data Report Generating error 13 Type Mismatch error what?
Miscellaneous
Thread ID:
00658630
Message ID:
00658630
Views:
85
Hi friends there!

It's me once again, still having this problem with the Data Environment stuff, Im new in this, but i really need to experience it, since it comes with VB 6.0 and it must be good!

Check the snippet of the code in which I have the problem:

first:

I have a global(public) conection for all my recordsets, which I call it cn, in the sub main module like this:


NOTE:
'==================================================================================
'I am an spanish speaker, therefore my comments are in Spanish, but is not a big deal to
'find out what is all about in this code, since I'm a beginner in Visual Basic, so my code is a 'child's play thing for understand, if you know what I mean...
'==================================================================================

Option Explicit
'declaro las funciones publicas a usar de la API, en este caso
'si manejan el sistema operativo Windows 98, podras apagar la
'maquina con esta hermosa funcion API: la ExitWIndowsEX

Public Const EWX_LOGOFF = 0
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_FORCE = 4
Declare Function ExitWindowsEx Lib "user32" _
(ByVal uFlags As Long, ByVal dwReserved _
As Long) As Long

'primeramente hago la coneccion manual a la
'base de datos, como me es comun hacerlo.

Public cn As ADODB.Connection

'mando a iniciar la coneccion
Sub main()

'si surge un error, hay que manipularlo
On Error GoTo Error_Handler
'establesco un nuevo tipo de coneccion de tipo ADO

Set cn = New ADODB.Connection
'declaremos el proveedor que voy a usar en la
'coneccion, en este caso el JEt de OLEDB 4.0

With cn
'de donde saldran los datos? de esta cadena de coneccion!
.ConnectionString = "PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & App.Path & "\Mdbinter.mdb"
'abramos ahora la coneccion
.Open
End With

'ahora necesitamos mandar a llamar a mi formulario
'splash, es decir mi presentacion del programa
frm_splash.Show

'si pasa algun error, mandemos a mostrar un mensaje
Error_Handler:
If Err.Description <> "" Then
MsgBox "Error Fatal. La aplicacion se cerrará debido a un " & _
Chr(13) & "error interno del Sistema Operativo." & _
Chr(13) & "Descripcion del Error: " & Err.Description & _
Chr(13) & "Numero de error " & Err.Number & _
Chr(13) & "consulte al proveedor del Sistema para más" & _
Chr(13) & "Información sobre estos Errores." & vbCritical + vbOKOnly, App.Title
End If
End Sub

Now, for let you know, the cn connection is only for my application's recordsets, With the Data Environment im using the connection of the data environment wizard, and I don't know if that is the problem, since i don't know how to create a data environment in code, and I am willing to learn, this way I can manipulate code from SQL for the commands with variables values from my Application, something that I really want to do, but don't know how to do it yet. I followed all the steps from the wizard to create the commands and the links and all that stuff with DE.

When I run my application, if I just call the show method of the report from the Main Menu, which is
rptDateNow.Show

there's no problem, but when it comes to refresh the data on the recordset of the command during the application runtime I am still receiving the error 13 type mismatch, what is wrong with this?
to refresh the recordset I use this line, right after the rptDateNow.Show line:

With DataEnvironment2.rscmdFechaRpt
.Open
.Requery
End With

NOTE HERE:

I've tried only with this line as well,but the same error appeared:
DataEnvironment2.rscmdFechaRpt.Requery


here's a snippet of the code Im using for my Report, is it an option from the main MDIForm Menu:

Private Sub mnu_cierre_Click()
On Error GoTo ErrHandler:
Dim strSQL As String
Dim cierre As Long
Dim myADORS As ADODB.Recordset
Set myADORS = New ADODB.Recordset

strSQL = "SELECT entradas " & _
"from tbl_entradas" & _
" WHERE (fecha = " & "#" & DateValue(Now()) & "#" & ")"
myADORS.Source = strSQL
'here I use the public connection from my sub main module
myADORS.ActiveConnection = cn
myADORS.Open
cierre = 0
Do Until myADORS.EOF
cierre = cierre + myADORS.Fields("entradas")
myADORS.MoveNext
Loop
MsgBox "El cierre del dia fue de:" & _
Chr(13) & "C$ " & Str(cierre) & " Cordobas netos", vbInformation + vbOKOnly, "Cierre del dia"
Set myADORS = Nothing
If MsgBox("Desea ver un reporte detallado del mismo?", vbQuestion + vbYesNo, "Reporte del Cierre del Dia:") = vbYes Then
rptDateNow.Show
With DataEnvironment2.rscmdFechaRpt
.Open
.Requery
End With
Else
Exit Sub
End If
'I got stuck here everytime the error happened, I mean the Application stops, but does not allow 'me to exit the function, just got stuck right at the beginning of the msgbox line.
ErrHandler:
If Err.Description <> "" Then
MsgBox "Error Inesperado!" + Err.Description + Err.Number, vbCritical + vbOKOnly, App.Title
Exit Sub
End If
End Sub

Note: The MsgBox line is not executed by the VB compiler, it got stuck right on this line!
Reply
Map
View

Click here to load this message in the networking platform