32 bit/64 bit access version issue :(

Stroud1977

Registered User.
Local time
Today, 00:31
Joined
Nov 30, 2013
Messages
45
Hi guys,

I've got a 64 bit windows laptop and PC, but my version of MS Access is 32 bit. It runs perfectly on my laptop and PC, but when i put a test copy of my database in our Dropbox to show a colleague something, he gets this error upon opening and can't use it (I think he's running a 64 bit version of Access).

"complile error:

The code in this project must be updated for use on 64 bit sytems.
Please review and update Declare statements and then mark them with the PtrSafe attribute."

I'm a newbie and this is my first database, so i'm in way over my head already :), but do i just have to change all my VBA code so he can view? If so, any idea what i need to change?

Many thanks dudes!

Steve
 
As the error states you need to update your code to run in both environments. Go through your code, and see if you have included any library function, something like.
Code:
Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Then all you have to do is, just..
Code:
Declare [B][COLOR=Red]PtrSafe [/COLOR][/B]Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
 
Thank you so much for your help. I really appreciate you taking the time.
Please bare with me, because like I said I'm in over my head :) , but I couldn't see any code that looked like that in my VBA, I searched for 'Declare' and 'dwMilliseconds' etc, but i must not have anything like that.
I have lots of things like this..

Private Sub Command55_Click()

If MsgBox(Prompt:="Are you sure?", Buttons:=vbYesNo, Title:="Delete") = vbYes Then
On Error Resume Next
DoCmd.RunCommand acCmdDeleteRecord
If Err.Number = 0 Then
MsgBox Prompt:="Deleted", Buttons:=vbOKOnly, Title:="Deleted"
Else
MsgBox Prompt:="There is no record to delete!", Buttons:=vbOKOnly, Title:="Error"
End If
Else
MsgBox Prompt:="Canceled", Buttons:=vbOKOnly, Title:="Canceled"
End If

End Sub

Would I need to enter 'PtrSafe' somewhere into the above code and others like it?

Thanks again for your patience.
 
Unfortunately the code will not be (mostly) in the form, you have to search the whole project. I can help. Just upload the file here.

I would not need any data, but I need the code intact. So delete all data in the tables, do not delete the tables itself. Also do not delete any Queries or Reports or Forms. Just data inside tables.
 
Hi Paul, that is very kind of you, thank you so much.

I've tried to upload the file here, but it's not letting me (The DB is 17mb), it might be because I've got under 50 posts?

Could I email it to you or send you a dropbox link?

Kind regards,

Steve
 
So you deleted all the data in the table and it still did not come down? Make sure after the data is deleted from the table you perform a Compact and Repair. It will bring down the size to measly KB's or atleast to a maximum of 2MB.
 
In your module, modFormPosition, you have..
Code:
[COLOR=Green]'API Declarations[/COLOR]
Declare Sub GetWindowRect Lib "user32" (ByVal Hwnd As Long, lpRect As FormCoords)
Declare Function GetDC Lib "user32" (ByVal Hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" (ByVal Hwnd As Long, ByVal hdc As Long) As Long
Declare Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Replace them as,
Code:
[COLOR=Green]'API Declarations[/COLOR]
Declare [COLOR=Red]PtrSafe [/COLOR]Sub GetWindowRect Lib "user32" (ByVal Hwnd As Long, lpRect As FormCoords)
Declare [COLOR=Red]PtrSafe [/COLOR]Function GetDC Lib "user32" (ByVal Hwnd As Long) As Long
Declare [COLOR=Red]PtrSafe [/COLOR]Function ReleaseDC Lib "user32" (ByVal Hwnd As Long, ByVal hdc As Long) As Long
Declare [COLOR=Red]PtrSafe [/COLOR]Function GetDeviceCaps Lib "gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
 
Paul, you are a lifeasaver. Thank you so much :)

If you ever need a band for a party, let us know!
 

Users who are viewing this thread

Back
Top Bottom