Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
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
Medium Priority
?
514 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 2000 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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
New style of hardware planning for Microsoft Exchange server.
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …

610 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