tdemoy
Mar 14th, 2000, 12:11 PM
I wrote a program with Visual Basic 6.0 which creates an ACCESS database.
I have also added a menu which allows me to access DataReports.
Sometimes, when the DataReport is called, I get the following error message:
The Microsoft Jet database engine cannot find the input table or query <name>. Make sure it exists and that its name is spelled correctly.
This error does not appeared systematically but when it happens, if I close the empty DataReport window and call again the menu, it works fine !...
If I run the program step by step in debug mode, everything is OK !...
Private Sub mnuRptHab_Click()
select_Hab
End Sub
'
' Delete and create QueryDef for DataReport
'
Public Sub select_Hab()
Dim Qd As QueryDef
On Error GoTo CheckErr
Db.QueryDefs.Delete ("rpt_hab")
SQL = "select * from VADM_HAB where (VADM_ID = " & AdmId & ") order by VADM_HABILITATION"
Set Qd = Db.CreateQueryDef("rpt_hab", SQL)
' relance le select SQL
VisiAdm.rsHabilitations.Requery
'
Qd.Execute
If Qd.OpenRecordset.RecordCount > 0 Then
rptHab.Show ' affiche le report
Else
MsgBox RRS(resNoRecord), vbExclamation
End If
Exit Sub
CheckErr:
Select Case Err
Case 429
MsgBox RRS(resError) & Err & " : " & Error(Err), vbCritical, "select_Hab..."
Case Else
Resume Next
End Select
End Sub
Private Sub DataReport_Initialize()
Me.Caption = RRS(lblHabList)
Sections(2).Controls(1).Caption = RRS(lblHabList)
Dim dico As String
dico = MainMDI.stBar.Panels("ficname").Text
i = InStrRev(dico, "\")
dico = IIf(i > 0, Mid(dico, i + 1, Len(dico) - i), dico)
Sections(2).Controls(3).Caption = dico ' dictionnaire
Sections(3).Controls(5).Caption = RRS(resHabName)
Sections(3).Controls(6).Caption = RRS(resPrimary)
Sections(3).Controls(7).Caption = RRS(resJointure)
Sections(3).Controls(8).Caption = RRS(resDescHab)
End Sub
I have also added a menu which allows me to access DataReports.
Sometimes, when the DataReport is called, I get the following error message:
The Microsoft Jet database engine cannot find the input table or query <name>. Make sure it exists and that its name is spelled correctly.
This error does not appeared systematically but when it happens, if I close the empty DataReport window and call again the menu, it works fine !...
If I run the program step by step in debug mode, everything is OK !...
Private Sub mnuRptHab_Click()
select_Hab
End Sub
'
' Delete and create QueryDef for DataReport
'
Public Sub select_Hab()
Dim Qd As QueryDef
On Error GoTo CheckErr
Db.QueryDefs.Delete ("rpt_hab")
SQL = "select * from VADM_HAB where (VADM_ID = " & AdmId & ") order by VADM_HABILITATION"
Set Qd = Db.CreateQueryDef("rpt_hab", SQL)
' relance le select SQL
VisiAdm.rsHabilitations.Requery
'
Qd.Execute
If Qd.OpenRecordset.RecordCount > 0 Then
rptHab.Show ' affiche le report
Else
MsgBox RRS(resNoRecord), vbExclamation
End If
Exit Sub
CheckErr:
Select Case Err
Case 429
MsgBox RRS(resError) & Err & " : " & Error(Err), vbCritical, "select_Hab..."
Case Else
Resume Next
End Select
End Sub
Private Sub DataReport_Initialize()
Me.Caption = RRS(lblHabList)
Sections(2).Controls(1).Caption = RRS(lblHabList)
Dim dico As String
dico = MainMDI.stBar.Panels("ficname").Text
i = InStrRev(dico, "\")
dico = IIf(i > 0, Mid(dico, i + 1, Len(dico) - i), dico)
Sections(2).Controls(3).Caption = dico ' dictionnaire
Sections(3).Controls(5).Caption = RRS(resHabName)
Sections(3).Controls(6).Caption = RRS(resPrimary)
Sections(3).Controls(7).Caption = RRS(resJointure)
Sections(3).Controls(8).Caption = RRS(resDescHab)
End Sub