Hi
Can some one tell me if it is a lot of work to convert vba code (Access 2.0) to vba code (A2003). I get problems with the vba code when I tried to convert it. I'm a newbie in VBA coding.
Thanks
Rune
Printable View
Hi
Can some one tell me if it is a lot of work to convert vba code (Access 2.0) to vba code (A2003). I get problems with the vba code when I tried to convert it. I'm a newbie in VBA coding.
Thanks
Rune
What exactly do you need to convert?
For Example i get an error message for the 3. row in this code when I convert from A 2.0 to A 2003
Function SetCaption()
Dim hWnd%
hWnd% = FindWindow%("OMain", 0&)
Call SetWindowText(hWnd%, idsAPPNAME)
End Function
Maybe its a problem behind this problem, but the first error message is that one.
Some advise?
Rune
Access 2.0 was designed for 16 bit Windows 3.1. Since then all of the core DLLs changed so did all of the functions/subs they expose.
In your case you need to declare variable as Long. Also api function declarations are different - instead of Integers they return Long types as well as all of the arguments that used to be Integers must be Long.
Note: % is the shortcut for Integer and Long is the &. Better way is to use the "As ..." when declaring variables.VB Code:
Private Declare Function SetWindowText Lib "user32" _ Alias "SetWindowTextA" (ByVal hwnd As Long, _ ByVal lpString As String) As Long Private Declare Function FindWindow Lib "user32" _ Alias "FindWindowA" (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Function SetCaption() Dim hWnd [B]As Long[/B] hWnd = FindWindow("OMain", 0&) Call SetWindowText(hWnd, idsAPPNAME) End Function
Thanks Rhinobull
Another error message occured now. I know it could be difficult with so little information.
Can someone see if it is something I need to do with this code to make it work in access 2003. The vba code is made for access 2.0.
Private Sub lstMeny_Click()
lstMeny.StatusBarText = DLookup("[StatusBarTxt]", "Q_SYS_Bld_Hovedmeny", "[FullName]= '" & Forms![F_Bld_HOVEDMENY]![lstMeny] & "'")
End Sub
This error message came when I click a button on the main menu(Hovedmeny) to open a form.
Thanks again I'm still a newbie :afrog:
Best regards
Rune