Eska
Eska

Reputation: 201

VBA code stopped working as intended

I have weird issue, code that was working suddenly started to generate an issue (i have no clue how to bypass it)

I have List Box (List2) on Form1, It's populated by:

SELECT [queryFormyTradycyjne].[Nr Maszyny], [queryFormyTradycyjne].[UID], [queryFormyTradycyjne].[Nazwa], [queryFormyTradycyjne].[UAP], [queryFormyTradycyjne].[Linia], [queryFormyTradycyjne].[GAP], [queryFormyTradycyjne].[Status] FROM queryFormyTradycyjne ORDER BY [Nr Maszyny]; 

queryFormyTradycyjne code:

SELECT Lista.[Nr Maszyny], Lista.[Nazwa], Lista.[UAP], Lista.[Linia], Lista.[GAP], Lista.[Status], Lista.[UID]
FROM Lista
WHERE Lista.isValid=False And Lista.UID Like 'FF*';

and if I'll double click on an item from List2 it supose to deliver value to the other form (AwariaZgloszenieNew), to the text field named txtNrMaszyny.

THAT was working just fine, since 2 hours ago. I actually didnt touch a thing in the code nor in any of these forms. I checked that on several PC's with different Access version installed. Same result: Error Method 'Item' of object 'Forms' failed (-2146500594 (800f000e))

My VBA code for double click event:

Public strSelectedItem As String

Private Sub List2_DblClick(Cancel As Integer)
Dim varItem As Variant

With Me.List2
    For Each varItem In .ItemsSelected
    strSelectedItem = .ItemData(varItem)
    Next
End With

DoCmd.OpenForm "AwariaZgloszenieNew"

[Forms]![AwariaZgloszenieNew].[txtNrMaszyny] = strSelectedItem

End Sub

Anyone with any kind of idea?

Upvotes: 0

Views: 109

Answers (1)

Andre
Andre

Reputation: 27634

If "Compact and repair" doesn't help, there are two more things you can try.

  • Decompile

How does one decompile and recompile a database application?
Follow the steps in David-W-Fenton's answer to the letter.

  • Create a new database and import all objects from the old one.

Edit -- just saw your latest comment.
If the VBA code is gone, and no working backup available, some parts may be lost. For the future: during development, "Compact and repair" and (to a lesser extent) Decompile should be regular tasks.

I don't know how Decompile works with password protected code.
IMHO a better option to protect code in Access is by distributing .mde frontends instead of .mdb

Upvotes: 1

Related Questions