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
510 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 58
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 58

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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

717 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