fitaliano
asked on
Invalid Data Format in Access VBA
When I try to compile my VBA project in Access I get the following error message:
"Invalid Data Format"
How can I fix it?
"Invalid Data Format"
How can I fix it?
check if you have missing reference
from VBA window
tools > references
from VBA window
tools > references
Posting the code would be helpful ...
mx
mx
ASKER
Wherever I click, I get the following message:
The expression On Click you entered as the event property setting produced the following error: Invalid Data Format
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error in evaluating the function, event or macro.
The expression On Click you entered as the event property setting produced the following error: Invalid Data Format
* The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
* There may have been an error in evaluating the function, event or macro.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Try this - to see where the error is occurring:
VBA Editor>>Tools>>Options>>Ge neral
*Temporarily* set Error Trapping to Break on All Errors.
Run you code. It's should break in code at the actual error line.
After the issue is fixed ... be SURE to set back to Break on Unhandled Errors.
mx
Capture1.gif
VBA Editor>>Tools>>Options>>Ge
*Temporarily* set Error Trapping to Break on All Errors.
Run you code. It's should break in code at the actual error line.
After the issue is fixed ... be SURE to set back to Break on Unhandled Errors.
mx
Capture1.gif
ASKER
I think I identified the problem. I can pretty much open all the Class Objects and all the modules but 2 modules.
When I click one of them it gives me: invalid data format
When I click on the other one it gives me: out of memory
I tried to delete these modules but it doesn't let me do it.
I keep getting "invalid data format" and "out of memory"
I tried to import a working code from a .bas file but instead of replacing the exiting modules, it creates new modules adding 1 at the end.
Recreating the database will take me 1 month.
When I click one of them it gives me: invalid data format
When I click on the other one it gives me: out of memory
I tried to delete these modules but it doesn't let me do it.
I keep getting "invalid data format" and "out of memory"
I tried to import a working code from a .bas file but instead of replacing the exiting modules, it creates new modules adding 1 at the end.
Recreating the database will take me 1 month.
Your vba project is Corrupted. Hope the Decompile suggested above fixes it.
Do you have a backup ?
mx
Do you have a backup ?
mx
ASKER
This is what I had in the incriminated modules:
1) -------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -------
Function fGetOut() As Integer
Dim RetVal As Integer
Dim db As DAO.Database
Dim rst As Recordset
On Error GoTo Err_fGGO
Set db = DBEngine.Workspaces(0).Dat abases(0)
Set rst = db.OpenRecordset("KickEmOf f", dbOpenSnapshot)
If rst.EOF And rst.BOF Then
RetVal = True
GoTo Exit_fGGO
Else
If rst!GetOut = True Then
'This is where you close down any forms, and quit the database
'I leave this section as an exercise in creativity
Application.Quit
Else
RetVal = True
End If
End If
Exit_fGGO:
fGetOut = RetVal
Exit Function
Err_fGGO:
'Note lack of message box on error
Resume Next
End Function
2) -------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- --------
Sub ShowUserRosterMultipleUser s()
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
Set cn = CurrentProject.Connection
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4.0 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets
Set rs = cn.OpenSchema(adSchemaProv iderSpecif ic, _
, "{947bb102-5d43-11d1-bdbf- 00c04fb926 75}")
'Output the list of all users in the current database.
Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend
End Sub
1) --------------------------
Function fGetOut() As Integer
Dim RetVal As Integer
Dim db As DAO.Database
Dim rst As Recordset
On Error GoTo Err_fGGO
Set db = DBEngine.Workspaces(0).Dat
Set rst = db.OpenRecordset("KickEmOf
If rst.EOF And rst.BOF Then
RetVal = True
GoTo Exit_fGGO
Else
If rst!GetOut = True Then
'This is where you close down any forms, and quit the database
'I leave this section as an exercise in creativity
Application.Quit
Else
RetVal = True
End If
End If
Exit_fGGO:
fGetOut = RetVal
Exit Function
Err_fGGO:
'Note lack of message box on error
Resume Next
End Function
2) --------------------------
Sub ShowUserRosterMultipleUser
Dim cn As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim i, j As Long
Set cn = CurrentProject.Connection
' The user roster is exposed as a provider-specific schema rowset
' in the Jet 4.0 OLE DB provider. You have to use a GUID to
' reference the schema, as provider-specific schemas are not
' listed in ADO's type library for schema rowsets
Set rs = cn.OpenSchema(adSchemaProv
, "{947bb102-5d43-11d1-bdbf-
'Output the list of all users in the current database.
Debug.Print rs.Fields(0).Name, "", rs.Fields(1).Name, _
"", rs.Fields(2).Name, rs.Fields(3).Name
While Not rs.EOF
Debug.Print rs.Fields(0), rs.Fields(1), _
rs.Fields(2), rs.Fields(3)
rs.MoveNext
Wend
End Sub
If you can fix it ... Wayne probably can:
http://www.everythingaccess.com/accessdatabaserepair.htm
mx
http://www.everythingaccess.com/accessdatabaserepair.htm
mx
ASKER
Yes, I have an old backup.
Is there anyway to delete these modules?
Is there anyway to delete these modules?
<Is there anyway to delete these modules?>
select the module and hit the delete key
select the module and hit the delete key
You can *try* ... importing everything into a new mdb - suggested above.
Otherwise ... hit up EverythingAccess ...
mx
Otherwise ... hit up EverythingAccess ...
mx
ASKER
Capricorn1,
if I select the module and then hit delete nothing happens. The only way I know is to right-click and selct remove module. Am I missing something?
if I select the module and then hit delete nothing happens. The only way I know is to right-click and selct remove module. Am I missing something?
select the module from the database objects window, then hit delete
ASKER
I did select the module in both the object navigation and the library (see printscreen attached) but I can't delete by hitting the "delete" button.
This could be a life saver, am I doing this right?
This could be a life saver, am I doing this right?
ASKER
I forgot to attach the printscreen
Select-Module.ppt
Select-Module.ppt
close the vba window..
go to the Access window
you should see the database objects window as shown
select the module and hit the delete key
databaseObjectsWindow.jpg
go to the Access window
you should see the database objects window as shown
select the module and hit the delete key
databaseObjectsWindow.jpg
ASKER
Yes, I tried that but those modules do not appear in this window.
from Access window
Tools >Options
View Tab
check the box for Hidden Objects then click OK
Tools >Options
View Tab
check the box for Hidden Objects then click OK
ASKER
I see all the modules but the incriminated 2...
can you upload the db?
Try the Import into new mdb as suggested above. You might get luck. Also the Decompile. But ... it's not looking good at this point. When you cannot delete w/o those error messages, the db is *usually* hosed.
Can you upload ? We might get lucky on a different system.
If all else fails, EverythingAccess can probably fix this for you ...
mx
Can you upload ? We might get lucky on a different system.
If all else fails, EverythingAccess can probably fix this for you ...
mx
ASKER
There you go...
******
Uploaded sample removed per Author's request:
https://www.experts-exchange.com/questions/26451240/05-Sep-10-17-Automated-Request-for-Attention-Q-26450802.html
The sample had no bearing on the progress towards a solution.
_alias99
Community Support Moderator
******
Uploaded sample removed per Author's request:
https://www.experts-exchange.com/questions/26451240/05-Sep-10-17-Automated-Request-for-Attention-Q-26450802.html
The sample had no bearing on the progress towards a solution.
_alias99
Community Support Moderator
fitaliano,
you are using a replica version of the db,
get the master db..
you are using a replica version of the db,
get the master db..
or try this
How to make a replicated database a regular database in Access
http://support.microsoft.com/?kbid=290052
How to make a replicated database a regular database in Access
http://support.microsoft.com/?kbid=290052
ASKER
No I am using the design master. If you remove the design master from its location it will lose its Design Master property.
Just go to Tools --> Replication --> Recover Design Master to do any modification
to access the main menu click on the company logo and type "bvr"
Just go to Tools --> Replication --> Recover Design Master to do any modification
to access the main menu click on the company logo and type "bvr"
??????
ASKER
I ended up re-importing all the objects in another clean db
ASKER
I assigned more points to DBMax who suggested the solution but I also benefitted from Capricorn1 suggestions as I had to decompile and delete select objetcs.
Thank you
Thank you
fitaliano, see my comment at http:#a33599071
mx just repeated my suggestion of importing all the objects in a new db
mx just repeated my suggestion of importing all the objects in a new db
fitaliano:
Whereas I do appreciate the pts and maybe a small Assist, the Accepted post (mine) was just pointing out what had ... already been posted by the other expert ... and further suggesting that you try that (importing/decompile) ... which in fact did turn out to be the fix.
You should hit the Request Attention button and change things around.
mx
Whereas I do appreciate the pts and maybe a small Assist, the Accepted post (mine) was just pointing out what had ... already been posted by the other expert ... and further suggesting that you try that (importing/decompile) ... which in fact did turn out to be the fix.
You should hit the Request Attention button and change things around.
mx
Additionally, you need to make sure that ever code module (whether it belongs to a form or a standard code module contains the following two lines:
Option Compare Database
Option Explicit