Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Is there a way to extract the Timevalue between two date
Message
De
22/05/2002 14:53:27
 
Information générale
Forum:
Visual Basic
Catégorie:
Autre
Divers
Thread ID:
00655190
Message ID:
00660095
Vues:
14
Dear Friend:

I am Using Visual Studio Enterprise Edition First disk, but I looked in the tools folder, and did not find it there. However, I am Still using the DataReport from VB6, but the only problem is that I am Receiving that error 13 , type mismatch error when I load it.

I am pretty sure that my Dataenvironment has the right connection, but I need to find out about create a Data environment instance in code and do all of the work for myself so I can find the problem in the code; I put a thread with all of my code, here is, once again the code for the DataEnvironment and mostly, for the Report I created, tell me what is wrong with this DataEnvironment, how come is giving me problems if is look like if is very easy to use and implement?
Thanks a lot for helping me find out about VB, this language is very productive!

here is the text for the thread I set last week:

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!
Thanks!
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform