Solved

How do I fix a compile error ( By Ref argument type mismatch) in an Access 2.0 conversion to newer 32bit version

Posted on 2011-03-03
4
508 Views
Last Modified: 2012-05-11
In a database I am trying to convert from access version 2  that has indicated a compile error  By Ref argument type mismatch  in the following.
where the yellow highlight picks up th line [ Function wu_GetAccessHwnd() As Long ]

'------------------------------------------------------------------------
' FUNCTION    : wu_GetAccessHwnd()
'
' PURPOSE     : Returns a handle the the Access window.
'------------------------------------------------------------------------
Function wu_GetAccessHwnd() As Long
    hwnd& = wu_GetActiveWindow()
    While ((wu_StWindowClass(hwnd&) <> WU_WC_ACCESS) And (hwnd& <> 0))
        hwnd% = wu_GetParent(hwnd&)
    Wend
    wu_GetAccessHwnd = hwnd&
End Function

[ I might say that relatively simple databases I have done for others  about six or seven years ago have been using Access 2003 and it's the differences between the the older version plus my rustiness that leads me here so thanks.]
0
Comment
Question by:kinerang
  • 2
  • 2
4 Comments
 
LVL 57
ID: 35032213

 Just replace the call with:

  = application.hWndAccessApp

 as it is now a supported property.

JimD.
0
 

Author Comment

by:kinerang
ID: 35078953
Hi Jim Sorry for not getting back earlier but have had other db things on my mind.  Now I replaced
 hwnd& = wu_GetActiveWindow() with hwnd& =application.hWndAccessApp and thought it had accepted but infact I needed to go back to the original
where the yellow highlight picks up th line [ Function wu_GetAccessHwnd() As Long ]

'------------------------------------------------------------------------
' FUNCTION    : wu_GetAccessHwnd()
'
' PURPOSE     : Returns a handle the the Access window.
'------------------------------------------------------------------------
Function wu_GetAccessHwnd() As Long
    hwnd& = wu_GetActiveWindow()
    While ((wu_StWindowClass(hwnd&) <> WU_WC_ACCESS) And (hwnd& <> 0))
        hwnd% = wu_GetParent(hwnd&)
    Wend
    wu_GetAccessHwnd = hwnd&
End Function

So where would you suggest I replace the call and if not that  (  due to the fact the whole db was written in Access version 2 format and is gradually being converted and reworked into 32bit  format ) what else could alternatively fix the  'by ref argument type mismatch'
with thanks
Paul
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 35082727
Paul,

  You no longer need the function wu_GetAccessHwnd().  Just delete it.  

  Anywhere you have =wu_GetAccessHwnd()

  should now read =Application.hWndAccessApp

JimD.

0
 

Author Closing Comment

by:kinerang
ID: 35136224
This has now led me to another error message. I'll enter it as a new question

Thanks Jim
Paul
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Office Picture Manager is not included in Office 2013. This comes as a shock to users upgrading from earlier versions of Office, such as 2007 and 2010, where Picture Manager was included as a standard application. This article explains how…
Technology opened people to different means of presenting information, but PowerPoint remains to be above competition. Know why PPT still works today.
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

861 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question