please help me ....please help me ... urgent...

G

Guest

hi all,

I am using VB 6.0 to open access form called "test' and hide the access
application window completely using win32 api function and show only form. i
have other forms also with in VB that are independent of access.
can u help me where i am going wrong...
The error message is "user defined type not defined" - points to the
function definition in standard module.

under the form module:

Dim appAccess As Access.Application
Const SW_HIDE As Integer = 0
Private Sub Command1_Click()
On Error GoTo ErrorHandler
Dim strDbName As String
strDbName = "E:\satya\erxp\Copy of dbfiletype.mdb"

' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDbName
' Open Orders form.
appAccess.DoCmd.OpenForm "test"


cmd1_Click_exit:
appAccess.CloseCurrentDatabase
Exit Sub
'WIN API Function call to hide the access application


Call fSetAccessWindow(appAccess, SW_HIDE)

ErrorHandler:
If Err.Number <> 0 Then


' Handle errors
MsgBox "An unexpected error has occurred." & _
vbCrLf & "Please note of the following details:" & _
vbCrLf & "Error Number: " & Err.Number & _
vbCrLf & "Description: " & Err.Description _
, vbCritical, "Error"
Resume cmd1_Click_exit
End If
End Sub

Under standard moodule it has :


Private Declare Function apiShowWindow Lib "user32" _
Alias "ShowWindow" (ByVal hwnd As Long, _
ByVal nCmdShow As Long) As Long
Public Function fSetAccessWindow(accApp As AccessApplication, nCmdShow As
Long)


Dim loX As Long
Dim loForm As Form
On Error Resume Next
Set loForm = accApp.Screen.ActiveForm
If Err <> 0 Then 'no Activeform
If nCmdShow = SW_HIDE Then
MsgBox "Cannot hide Access unless " _
& "a form is on screen"
Else
loX = apiShowWindow(accApp.hWndAccessApp, nCmdShow)
Err.Clear
End If
Else
If nCmdShow = SW_SHOWMINIMIZED And loForm.Modal = True Then
MsgBox "Cannot minimize Access with " _
& (loForm.Caption + " ") _
& "form on screen"
ElseIf nCmdShow = SW_HIDE And loForm.PopUp <> True Then
MsgBox "Cannot hide Access with " _
& (loForm.Caption + " ") _
& "form on screen"
Else
loX = apiShowWindow(accApp.hWndAccessApp, nCmdShow)
End If
End If
fSetAccessWindow = (loX <> 0)
End Function


please help me finding the bug... thanks for your consideration.
and thanks a lot
 
J

Jeff Boyce

I'm not familiar with the api call, but it looks to me like you have a
reference missing. That error message generally shows up when code tries to
refer to something that isn't defined (i.e., referenced).

Good luck!

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
D

Dirk Goldgar

[...]
Public Function fSetAccessWindow(accApp As AccessApplication,
nCmdShow As Long)

Is that really what you have? Shouldn't that first arguments type be

Access.Application

not

AccessApplication

?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top