Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB Problem upgrading from Access 97 to Access 2000

Status
Not open for further replies.

SpiritOfLennon

IS-IT--Management
Oct 2, 2001
250
GB
Hi,
I have the following section of VB code which runs a query on an access database and displays the result in a dataview. It used to work fine on Access 97, now however the database has been upgraded to 2000 and when I try and run it, it seems to get stuck in the loop section. Any ideas what the difference is between 97 and 2000 that could be causing the problem?
Regards SOL

Sub OpenQuery(qryName As String)

Dim oAccess As Object, lHandle As Long, lAccessHwnd As Long

On Error GoTo QueryError
Screen.MousePointer = vbHourglass
Set oAccess = CreateObject("Access.Application.9")
oAccess.OpenCurrentDatabase DBname, False

oAccess.DoCmd.OpenQuery qryName

oAccess.DoCmd.Maximize 'maximize the display window
lAccessHwnd = oAccess.Application.hWndAccessApp

If IsIconic(lAccessHwnd) Then ShowWindow lAccessHwnd, SW_SHOWNORMAL
ShowWindow lAccessHwnd, SW_SHOWMAXIMIZED

lHandle = oAccess.Forms("frmMainMenu").hwnd
'Do While IsWindow(lHandle)
' DoEvents
'Loop

oAccess.Quit 2 'acQuitSaveNone
Set oAccess = Nothing
GoTo OpenQuery_Exit

QueryError:
MsgBox Error

OpenQuery_Exit:
Screen.MousePointer = vbDefault

End Sub
 
Set oAccess = CreateObject("Access.Application.9")
this only apply to one version of Access.
try
Set oAccess = CreateObject("Access.Application")


Regards

Frederico Fonseca
SysSoft Integrated Ltd
 
Frederico,
Unfortunately that didn't fix it, it still just throws an MS Access window up that is blank and says datasheet view in the bottom corner. Thanks for the advice though.
Regards Steve

SOL
I'm only guessing but my guess work generally works for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top