joyfullservice / msaccess-vcs-addin

Synchronize your Access Forms, Macros, Modules, Queries, Reports, and more with a version control system.
Other
203 stars 39 forks source link

bas files splitting object names onto different lines #528

Open rsonnier-cfs opened 1 month ago

rsonnier-cfs commented 1 month ago

This has been an issue for us for a long time. It does not affect the export or build or anything directly related to the version control add-in. But we have built extensive source code search features for internal use. And because the .bas files in the source folders split lines often for ControlSource or RecordSource, the search occasionally misses an object because the line split occurs in the middle of an object name. This very well may be outside the scope of the VCS project and I just have to find a way to code my search to interpret the source as a single line.

In the example below, the linked table name in the ControlSource is "dbo_LK_Requirement_Raw_Material" and since the line is split on the underscore, my search does not detect the object name and wont find this occurrence of the object. The second example show ControlSource split in the middle of a word. Looks like the export is limiting to 80 characters of code per line.

I have already tested and eliminated Example1 in my database by building and linking a SQL view with the data element required and getting rid of the ControlSource on the textbox.

Example1: {path to source}\database1.mdb.src\forms {linkedTableName|.bas Begin TextBox Enabled = NotDefault Locked = NotDefault TabStop = NotDefault OldBorderStyle =0 OverlapFlags =93 TextAlign =2 IMESentenceMode =3 Left =9000 Top =360 Width =1680 FontSize =8 TabIndex =13 BorderColor =9737368 ForeColor =10855845 Name ="Barstock" ControlSource ="=IIf(Mid([Forms]![assylgnd].[Form]![assylgndDtl]![PART_ID],1," "5)=\"AA235\" Or Mid([Forms]![assylgnd].[Form]![assylgndDtl]![" "PART_ID],1,5)=\"CN240\",\"\",DLookUp(\"[Req_Part_ID]\",\"dbo_LK_RequirementRaw" "Material\",\"[PART_ID]='\" & [PART_ID] & \"'\"))" GridlineColor =10921638

                LayoutCachedLeft =9000
                LayoutCachedTop =360
                LayoutCachedWidth =10680
                LayoutCachedHeight =600
                BorderShade =65.0
                ForeThemeColorIndex =-1
                ForeShade =100.0
            End

Example2: Begin TextBox FontUnderline = NotDefault TabStop = NotDefault OldBorderStyle =0 OverlapFlags =93 IMESentenceMode =3 Left =6120 Top =360 Width =2580 FontSize =8 TabIndex =14 BorderColor =9737368 ForeColor =10855845 Name ="Text77" ControlSource ="=DLookUp(\"[DRAWING_FILE]\",\"dbo_PART\",\"[ID] = [Forms]![assylgnd].[Fo" "rm]![assylgndDtl]![PART_ID]\")" OnGotFocus ="[Event Procedure]" GridlineColor =10921638

                LayoutCachedLeft =6120
                LayoutCachedTop =360
                LayoutCachedWidth =8700
                LayoutCachedHeight =600
                BorderShade =65.0
                ForeThemeColorIndex =-1
                ForeShade =100.0
            End
rsonnier-cfs commented 1 month ago

Looks like the export uses MS-Access undocumented feature Application.SaveAsText so this behavior is simply a limitation of this method that cannot be changed.

hecon5 commented 1 month ago

This relates to an earlier feature we were discussing about parsing query exports. What you've described is that almost to a "T": #184 where we briefly discussed parsing the exported lines as a group. I closed it when it became apparent the work that's required to do so and the low amount of excess time I had on my hands; but we did flesh out some possible paths forward.

rsonnier-cfs commented 1 month ago

Thank you for the reference to #184. As a new participant here I would likely not have found that.

We are currently coding a way to un-parse the data so we can execute our searches with 100% accuracy. Once we have that code built I would be happy to contribute if it can be used here in any way.

This issue for us is tangential to the actual VCS Addin, but due to the size of our development environment, and the size and number of our access databases /applications, having an accurate source code search feature allows us to identify if and exactly where any of literally thousands of objects are referenced in any of our databases. For example, I can enter a SQL table name, and locate exactly what linked tabledefs and or queries use that. Or if I need to modify a SQL view I can get an absolute list of which of 50 Access databases, if any, could be impacted and assess the potential for undesirable results.