Bryan Carbonnell
Bryan_Carbonnell at cbc.ca
Fri Apr 16 13:25:05 CDT 2004
Since the command button and the sub form are on the same subform, try Me.Form(sSearchField).ColumnOrder = 1 Bryan Carbonnell bryan_carbonnell at cbc.ca >>> clh at christopherhawkins.com 16-Apr-04 2:00:46 PM >>> ..although I looked at this page: http://www.databaseadvisors.com/newletters/newsletter032004/0310Refere nceGuide/SyntaxForSubs.htm The syntax just isn't working. So, to restate the problem: The Overview: frmMain, which has a subform control named sFrm. sFrm's SourceObject = "frmSearch" frmSearch, which has a button named cmdSearch and a subform control named sFrmResults. sFrmResults' SourceObject = "frmResults". frmResults, which has a bunch of fields like FirstName, LastName, etc. Typical customer database stuff. frmResults displays as a datasheet. The Problem: In the code behind cmdSearch, there is a line that tries to re-order the columns in the datasheet contained in sFrmResults. That code looks like this: [sFrmResults].Form(sSearchField).ColumnOrder = 1 That line of code tries to execute but instead yields this error: Method 'Form' of object '_Subform' failed. Now, this is also totally vanilla, but for some reason it just won't work. I tried pulling frmSearch out of frmMain so that the search form was it's own form instead of being a subform, and this line worked just fine then. Unfortunately, my client will not accep that change as a solution; frmSearch must remain a subform. But that line just does not work when frmSearch is a subform.