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

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VPN speed vs Internet Bandwidth 3 39
Pull Phone Number out of Cell 3 12
Set a Range to a Cell in Excel VBA 2 17
need counting specific data on sheet 26 24
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
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 …

730 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