Many a time Ive raised a query here and following further review have found the problem to be a bit of rogue code etc running that I hadnt realised, this time however its different.
I have a large Excel/Access application that pulls data, displays it in a form and allows the user to work on it, due to system and network constraints this has been developed in such a way as to cut down wherever possible on the transactions across the ADO so it pulls lots of data in at the start, copies selected items to internal sheets for working on and then writes back to the Db when required. The problem I have is in the early stages, where a user selects a case to work on, below is a basic description of the steps taken when a user first opens the app, requests a list of cases and selects one.
On Opening the App, a list of all cases possible for that user is pulled via ADO and dropped into a specific Sheet (CaseList)
If the user opens the Case Selection Form and selects relevant filtering criteria, the code will cycle through CaseList sheet and populate the ListBox with those cases that match the criteria.
User then selects an item and hits the Open button.
The first thing done then is to grab the relevant row from the CaseList sheet, copy it and Paste it into Row 2 of the "Case" sheet, before opening the frmCase Form. (Ive even tried removing this portion of the code and reverting back to pulling the relevant record from ADO and dropping it into the sheet, which still correctly populates but ulitmately ends with the data not being there).
The Initialize event of the form then does numerous actions to populate the fields (using the data in "Case" sheet), do some calculations etc before displaying the form and ending the code.
All of this works perfectly, the final result is the form is displayed with the data from the case populated (Therefore I know that the Case sheet definitely contained the data when the form was Initialized).
However, at some stage it seems to delete Row 2 from the Case sheet BUT only if the code is ran outside of Debug, if I debug at any stage of the code process (even the very last End Sub line) then the data is still there. Let it run through as normal though and the Case sheet contains no data in Row2 (the headings in Row1 are still there though).
Ive even tried duplicating the row copy and paste at the very end of the process which (when followed in Debug) is actioned correctly however again, in "normal" running it then disappears.
I am at a loss, normally debug would highlight where the problem is but this appears to be something outside of the code which isnt ran in debug mode?
Things that I know happen
Data is correctly copied from CaseList to Case sheet (resulting in a single row of data in row 2)
Data is then correctly populated from Case sheet into the form fields (therefore data is definitely still there when the Form Initialize runs).
I know people will want the workbook uploading but it will require a number of changes to make it operate elsewhere and like I say, Im 99.9% confident its not code at fault (or at least not code that can be seen to run in debug mode) so was wondering if anyone had seen anything like this before ie it works in debug but not in live.
Bookmarks