B
Bob Barnes
The code below ran in VB6 and the called Access DB was NOT visible.
We've transferred the code to another Access DB..the code works fine, but
the called Access DB is visible.
These are Public varaiables..
gnMcnCopies, gDailyRep, gDateSel, gShiftSel, gIDGroup & gIIDProc
Tips?? TIA - Bob
Private Sub GoPrint()
Dim MainDB As Access.Application
On Error GoTo AAA1
Screen.MousePointer = 11
Set MainDB = CreateObject("Access.Application.11")
txtCopies = gnMcnCopies
Select Case gDailyRep
Case "0", "N/A"
'No report to print
MsgBox "There is no report for this Group/Process."
Case Else
lbl275.Visible = True: txtCopies.Visible = True: Me.Repaint
End Select
With MainDB
.OpenCurrentDatabase ("C:\BobDev\pas3dot2.mdb")
.Visible = False
.DoCmd.OpenForm "VB-to-Acc Rpts"
.Forms![VB-to-Acc Rpts]!txtProdDate = gDateSel
.Forms![VB-to-Acc Rpts]!txtPartsDate = gDateSel
.Forms![VB-to-Acc Rpts]!txtProdShift = gShiftSel
.Forms![VB-to-Acc Rpts]!txtGroupID = gIDGroup
.Forms![VB-to-Acc Rpts]!txtProcessID = gIIDProc
.Forms![VB-to-Acc Rpts]!cmdSetGlobalVariables.SetFocus
If txtCopies = 1 Then
.DoCmd.OpenReport (gDailyRep)
txtCopies = 0: Me.Repaint
ElseIf txtCopies = 2 Then
.DoCmd.OpenReport (gDailyRep)
txtCopies = 1: Me.Repaint
.DoCmd.OpenReport (gDailyRep)
txtCopies = 0: Me.Repaint
ElseIf txtCopies = 3 Then
.DoCmd.OpenReport (gDailyRep)
txtCopies = 2: Me.Repaint
.DoCmd.OpenReport (gDailyRep)
txtCopies = 1: Me.Repaint
.DoCmd.OpenReport (gDailyRep)
txtCopies = 0: Me.Repaint
End If
lbl275.Visible = False: txtCopies.Visible = False
.Visible = False
.CloseCurrentDatabase
.Quit: Set MainDB = Nothing
End With
AAA2:
Screen.MousePointer = 1: Exit Sub
AAA1:
Select Case Err
Case 2501
Resume AAA2
Case Else
MsgBox Err.Number & " " & Err.Description
Resume
GoTo AAA2
End Select
End Sub
We've transferred the code to another Access DB..the code works fine, but
the called Access DB is visible.
These are Public varaiables..
gnMcnCopies, gDailyRep, gDateSel, gShiftSel, gIDGroup & gIIDProc
Tips?? TIA - Bob
Private Sub GoPrint()
Dim MainDB As Access.Application
On Error GoTo AAA1
Screen.MousePointer = 11
Set MainDB = CreateObject("Access.Application.11")
txtCopies = gnMcnCopies
Select Case gDailyRep
Case "0", "N/A"
'No report to print
MsgBox "There is no report for this Group/Process."
Case Else
lbl275.Visible = True: txtCopies.Visible = True: Me.Repaint
End Select
With MainDB
.OpenCurrentDatabase ("C:\BobDev\pas3dot2.mdb")
.Visible = False
.DoCmd.OpenForm "VB-to-Acc Rpts"
.Forms![VB-to-Acc Rpts]!txtProdDate = gDateSel
.Forms![VB-to-Acc Rpts]!txtPartsDate = gDateSel
.Forms![VB-to-Acc Rpts]!txtProdShift = gShiftSel
.Forms![VB-to-Acc Rpts]!txtGroupID = gIDGroup
.Forms![VB-to-Acc Rpts]!txtProcessID = gIIDProc
.Forms![VB-to-Acc Rpts]!cmdSetGlobalVariables.SetFocus
If txtCopies = 1 Then
.DoCmd.OpenReport (gDailyRep)
txtCopies = 0: Me.Repaint
ElseIf txtCopies = 2 Then
.DoCmd.OpenReport (gDailyRep)
txtCopies = 1: Me.Repaint
.DoCmd.OpenReport (gDailyRep)
txtCopies = 0: Me.Repaint
ElseIf txtCopies = 3 Then
.DoCmd.OpenReport (gDailyRep)
txtCopies = 2: Me.Repaint
.DoCmd.OpenReport (gDailyRep)
txtCopies = 1: Me.Repaint
.DoCmd.OpenReport (gDailyRep)
txtCopies = 0: Me.Repaint
End If
lbl275.Visible = False: txtCopies.Visible = False
.Visible = False
.CloseCurrentDatabase
.Quit: Set MainDB = Nothing
End With
AAA2:
Screen.MousePointer = 1: Exit Sub
AAA1:
Select Case Err
Case 2501
Resume AAA2
Case Else
MsgBox Err.Number & " " & Err.Description
Resume
GoTo AAA2
End Select
End Sub