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
505 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Outlook Free & Paid Tools
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

747 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now