programmatically changing size of continuous forms

I know you are not supposed to double post, but I accidentally posted first 
to a newsgroup that appears to be no longer active 
(microsoft.public.access.formsprogramming).  So, I am trying here as well.

I've tried searching the internet in a variety of ways to get this one, but
can't find it.  I have a continuous form that opens at first with no records
and the Detail section's visible property set to No.  The user selects a
criteria from the combo box (e.g., cboCriteria) in the header, the
after_update event of which goes something like this:
                            lngID=me.cboCriteria
                            strSQL="SELECT * FROM tblMyTable WHERE ID=" &
lngID
                            me.recordsource=strSQL
                            me.Detail.visible=true
                            docmd.RunCommand acCmdSizeToFitForm

     The above code does NOT seem to change the size of the form.  What I
want to happen, if this is possible, is for the form to expand or shrink
depending on the number of records to be displayed in the Detail section,
and for the area displaying the data to grow or shrink each time the user
selects a new value from the combo box.  The number of records to be
returned after each selection from the combo box  varies only from 0 to 18,
so the form only needs to expand or shrink a few inches of screen height.
Is this possible?

I have wondered about this for years, and usually just find a way around it.
But now I just want to know.  Thanks.  --John 


0
JohnB
11/10/2007 1:23:48 AM
access.formscoding 7494 articles. 0 followers. Follow

1 Replies
1299 Views

Similar Articles

[PageSpeed] 41

John,

You can change the forms height by using the InsideHeight property of the 
form.  Figure out the height of a single record in the detail section 
(HtSnglRec) and multiply that by the number of records returned

So, instead of the DoCmd.RunCommand entry, try

me.insideheight = me.section(1).height + me.section(2).height + 
(me.recordsetclone.recordCount * HtSnglRec) * 1440

You might want to set the maximum height for the detail section, so you 
don't end up with too many records displayed at once.  If you do this, you 
will want to make sure that you display the vertical scrollbar as well.

Dim intDetRows as integer
if me.recordsetclone.recordcount > 5 then
    intDetRows = 5
    me.scrollbars = 2
else
    intDetRows = me.recordsetclone.recordCount
    me.scrollbars = 0
endif
me.insideheight = me.section(1).height + me.section(2).height + (intDetRows 
* htSnglRec) * 1440

The challenge with this is not to make the form extend off of the screen. 
There is a way to determine the height of your screen and reposition the 
form so that it is centered vertically, but I'll have to do some research to 
remember how.  I think there is an API call or two involved.

HTH
Dale

"JohnB" <johnberks@comcast.net> wrote in message 
news:cJednVYV0uVumqjanZ2dnUVZ_veinZ2d@comcast.com...
>I know you are not supposed to double post, but I accidentally posted first 
>to a newsgroup that appears to be no longer active 
>(microsoft.public.access.formsprogramming).  So, I am trying here as well.
>
> I've tried searching the internet in a variety of ways to get this one, 
> but
> can't find it.  I have a continuous form that opens at first with no 
> records
> and the Detail section's visible property set to No.  The user selects a
> criteria from the combo box (e.g., cboCriteria) in the header, the
> after_update event of which goes something like this:
>                            lngID=me.cboCriteria
>                            strSQL="SELECT * FROM tblMyTable WHERE ID=" &
> lngID
>                            me.recordsource=strSQL
>                            me.Detail.visible=true
>                            docmd.RunCommand acCmdSizeToFitForm
>
>     The above code does NOT seem to change the size of the form.  What I
> want to happen, if this is possible, is for the form to expand or shrink
> depending on the number of records to be displayed in the Detail section,
> and for the area displaying the data to grow or shrink each time the user
> selects a new value from the combo box.  The number of records to be
> returned after each selection from the combo box  varies only from 0 to 
> 18,
> so the form only needs to expand or shrink a few inches of screen height.
> Is this possible?
>
> I have wondered about this for years, and usually just find a way around 
> it.
> But now I just want to know.  Thanks.  --John
> 


0
Dale
11/10/2007 2:49:51 AM
Reply:

Similar Artilces:

Changing ChartTypes will not change the color of the Series
I have Excel 2007 and trying to make this compatible with users that have Excel 2002/2003. I am having a hard time with the code below. When I change a specific series from a stacked chart to a line and then try to change the color, I am not successful. I am successful with changing the chart type, however. 'Create the Average Line .ActiveChart.PlotArea.Select .ActiveChart.SeriesCollection.NewSeries y = .ActiveChart.SeriesCollection.Count .ActiveChart.SeriesCollection(y).Values = "=Sheet2!R" & intRow + 1 & "C2:R...

multiple select list boxes to filter form display
I have been searching for weeks for a solution but to no avail. My form has multiple-select list boxes (both text and numbers) that contain customer contact info, company revenue, and sales relationships. How do I code it so that the form displays (which will exentually be exported to Excel) only the records based on the multiple criteria selectioned within each box? Any help you can offer is appreciated. I'd rather not resort to a pivot table, which is the only alternative I can think of. Rebecca Rebecca, There are a couple of ways to do this. 1. One is to write code to dynami...

Is There Anyway To Change Investment Type In Money 2002?
When Money imported some of my Mutual Funds from Quicken it identified them as bond. This causes a problem when entering prices. Is there anyway to change inverstment type for these assets? Is there anyway to do this in later versions of Money? In microsoft.public.money, Mike wrote: >When Money imported some of my Mutual Funds from Quicken >it identified them as bond. This causes a problem when >entering prices. Is there anyway to change inverstment >type for these assets? Is there anyway to do this in >later versions of Money? Cease. ...

File Sizes & Archiving
Dear All, In version three how can I change the system size of documents for and attachments. I believe the maximum size is 5 mb but my users require it to be 15 - 20 mb. Is there an archiving solution for all those documents that are attached with an opportuniuy that is lets says three months old? Hi Faiz, You will need to edit the registry to increase the file size. On the server, use: HKEY_LOCAL_MACHINE\Software\Microsoft\MSCRM\maxuploadfilesize On the outlook client: HKEY_CURRENT_USER\Software\Microsoft\MSCRMClient\maxuploadfilesize HTH, Niths "Faiz Amir" wrote: &g...

How to change default path of CFileDialog?
I want to open data file in "C:\temp" (e.g.), but CFileDialog always direct to 'C:\My Document' at opening. My code: CFileDialog dlg(TRUE); dlg.m_pOFN->lpstrInitialDir = "C:\temp"; kathy wrote: > I want to open data file in "C:\temp" (e.g.), but CFileDialog always > direct to 'C:\My Document' > at opening. > > My code: > > CFileDialog dlg(TRUE); > dlg.m_pOFN->lpstrInitialDir = "C:\temp"; > kathy: CFileDialog dlg(TRUE); dlg.m_pOFN->lpstrInitialDir = "C:\\temp"; You must escape the \ ...

Changes with Outlook 2007
I'm having some issues with the new "Features" Outlook 2007 has. Some of our executives don't want to see the name of the organizer of the appointments. It leads to confusion for WHO should actually attend. Is there a way to disable that feature, or is there a particular layout which would not show the physical sender's name? Thanks! No; No. It can't be removed and can't be controlled by a view. -- Diane Poremsky [MVP - Outlook] Outlook Tips: http://www.outlook-tips.net/ Outlook & Exchange Solutions Center: http://www.slipstick.com/ O...

Change icon
I am working on a small Excel project. Is there a way to change the Excel icon on my desktop (for my project) so that I can personalize that icon? Thanks Peter wrote: > I am working on a small Excel project. Is there a way to > change the Excel icon on my desktop (for my project) so > that I can personalize that icon? If the "Excel icon" is already a shortcut, right-click on it and use Properties >> Shortcut >> Change Icon You can tell shortcuts by the little arrow in a square in the lower left corner of the icon. If it isn't a already a shortcut...

change the color of non-printing characters in this version of Word?
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) How does one change the color of non-printing characters in Word 2008 12.2.3 for Mac?? <br><br>In previous versions, the non-printing characters were greyed, in the new version they are blue and are a *huge* distraction. <br><br>Thanks You can turn the Off by clicking the "=C2=B6" to turn them on click it ag= ain. KW@officeformac.com wrote: > Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) How does > one change the color of non-printing characters in Word 2008 12.2.3 fo...

Listing calendar events by attachment size.
Entourage 2008 for Mac, Web Services Edition. Version 13.0.4 My user is trying to list all calendar events that have attachments. Her inbox on the Exchange server is getting full and it's always because people include all sorts of documents in the meeting request. In Entourage when I list "all events", events with attachments do not show up in that list with the Attachment check box checked. If I go back to the PC in Outlook and say search for Calendar events with attachments messages show up in the list. Can these only be listed and deleted on the PC? Sounds sil...

How do you change the color of the row and column axis cells?
I'm wondering how to change the color of the row and column cells that identify what row and column you're in (e.g. "B" or "2"). The color in Excel Pro is a kind of puke orange. That a global Windows setting Right click on empty space on desktop; click Properties;open Appearances tab; play with colour setting to taste best wishes -- Bernard V Liengme www.stfx.ca/people/bliengme remove caps from email "HistoryTapes" <HistoryTapes@discussions.microsoft.com> wrote in message news:5F8774CA-A534-4EFD-A5A9-8BEF1CC05056@microsoft.com... > > ...

Change Location of Outlook 2003 PST Data File
I want to change the location of my Outlook 2003 PST Data File - where do I do that? Thanks With Outlook closed, find and move the file to the location of your choice (I'd also rename it if it's called outlook.pst - I prefer yourname.pst as it helps you keep track of things). Then open Outlook, and when it complains it can't find the file, point it at the right location. Close Outlook, reopen it....it should be fine. Bill wrote: > I want to change the location of my Outlook 2003 PST Data > File - where do I do that? > > Thanks ...

Programmatically Minimizing my App?
Hi, How can I programmatically Minimizing my App? Thanks, Scott Metzger Try ::ShowWindow( hWnd, SW_SHOWMINIMIZED /* or SW_FORCEMINIMIZE in W2K & XP */ ); -- Cheers Check Abdoul [ VC++ MVP ] ----------------------------------- "Scott Metzger" <NOSPAMScott.Metzger@york.com> wrote in message news:3F621CDB.2060406@york.com... > Hi, > > How can I programmatically Minimizing my App? > > Thanks, > Scott Metzger > ...

Change supplier name
Hi can anyone tell me how to change the supplier name for a list of existing items to another existing supplier name, without having to do it one by one. -- Gord We have this as part of our Store and HQ Utility add-on - one of 37 wizards that are not in RMS :) Contat me for more info Afshin Alikhani - afshin@retailrealm.co.uk Retail Realm = = = = = = = = "Gord" <Gord@discussions.microsoft.com> wrote in message news:FA72EFB9-D760-484C-B315-7C3B6E236CA1@microsoft.com... > Hi can anyone tell me how to change the supplier name for a list of > existing > items to a...

change spaces to _
Is there a way for access to return what was being input into a text box I am having trouble with trailing spaces (access text box removes it) therefore I am thinking to format it to "_", therefore I am still able to preserve the length -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-modules/201005/1 Help wrote: >Is there a way for access to return what was being input into a text box > >I am having trouble with trailing spaces (access text box removes it) >therefore I am thinking to format it to "_"...

Calculating percentage from eneterd values within a table/form
Within my database I have a table where I will enter the fresh weight of an object in one field and the thawed weight of the object in another field. I then wish access to calculate the percentage weight loss by : (Fresh Weight-Thawed Weight)/Fresh Weight*100 I have attempted to do this as a default value of a field during the design of a table, but as data has not been entered into the weight fields access gets confused and won't allow this. Is there a way to do this without creating a query or doing it within a form? If I have to create a query or do it within the form, is...

Create Requisitions Programmatically
Hi I need some help creating Requisitions programmatically. Here is the process that we want to follow. 1.. Vendors drop their files in a directory 2.. The program reads the files and performs some validations. 3.. A new Requisition should created automatically Can someone please give me some guidance and where possible some sample code to perform the above. I am strong in .NET development but is a newbie in GP. I have the development environment setup and is going through eConnect documentation. All help is greatly appreciated. TIA walterd ...

Changing a bar chart
In a standard bar chart, with say 5 yrs of data, I wish to make the 2006 bar a stacked bar with the lower part the ytd and the upper part of the bar the estimated year end. Pls help. -- \\\|/// \\ ~ ~ // ( @ @ ) --oOOo-(_)-oOOo--- Charlie Woll You could enter the data in two rows, then create a stacked column chart from all the data. For example: 2002 2003 2004 2005 2006 YTD 50 55 60 65 30 Est 40 Charles Woll wrote: > In a standard bar chart, with say 5 yrs of data, ...

Purchase Order Blank Form
Hi, I need to show the tax detail on the PO reprot. GST and PST how can i do that ? please help thanks Syed Dear Syed, You can modify the report by report writer and add all the fields you want to your report if it was linked to your report tables. Mohammad Daoud | Technical Development Manager | Mobile +962 79 999 65 85 Tel. +962 6 554 3721 | daoudm@greatpbs.com http://www.greatpbs.com| http://www.facebook.com/group.php?gid=18895609248/ "Syed" wrote: > Hi, > > I need to show the tax detail on the PO reprot. > GST and PST > > how can i do that ? ...

How to open a blank form for adding a new record
Hello, I have a form for adding/viewing employee records. I can open the form, view records and using the navigation button, add a new record just fine. However, I'd like to open the form using a command button so that all fields are blank and a new record can immediately been added without having to use the navigation button. Can anyone help me figure out how to do this? TIA, Rich On Tue, 13 Nov 2007 13:20:02 -0800, rich wrote: > Hello, > > I have a form for adding/viewing employee records. I can open the form, > view records and using the navigation button, add a...

Hyperlinks Changing on their own
Ok, I haven't been drinking...This has been verified on multiple computers, with Office 2000 & 2003. I have a worksheet that contains hyperlinks to other worksheets within the same workbook. When I open the workbook, the hyperlinks are correct. If I do NOTHING and save, the hyperlinks now point to some other page in the workbook. There are no marcros in this workbook, and it is fairly small ( 5 worksheets ) . Again, I made no changes ( not even typing in a cell or clicking the hyperlink ) and they changed. I even tried Save as Excel97 and the same thing happened. Any ideas out the...

get data form cells sequentially #2
Thank very much for the reply, but i must be a little thick as i still couldnt figure it out, could you please, if you get a minute check out my spreadsheet which i have uploaded onto my server? You will see some date at consuistent intervals down column G and also where i woul like all these date to apear along row 1 starting at J (this is where i would like to continue using the formula?? I hope i have described this well enough and thanks again for all your help!!!! here is the link to my spreadsheet - http://www.masson.tv/sepcalc.xls Thanks again Kind regards Swmasson -- swmasso...

Matrix Item Changes
We finally upgraded to 2.0 today. One of the first things I noticed was that we used to be able to open the parent matrix item and then go in and change the sale price, or Item Not Discountable, for all of the components of the matrix at one time. We could make the change in the top row, copy it and then paste to all rows. I cannot find a way to add those columns to the Component Items section in the new Item Matrix Properties window. Are we going to have to open each Matrix Component individually to make them Not Discountable, or else run the Item Wizard to change the sale informat...

Money-Changing Account number to handle Vanguard changes
Hi: Vanguard has changed the account numbers for its brokerage accounts. This has caused money to download brand new accounts with nothing in them and stop updating my old account numbered accounts. I changed the account numbers in Account Detail page but still not working. Anyone who has any info on what I'm missing please pass along. I cannot lose years and years of past data by just switching to the newly downloaded accounts. Greg PS: Microsoft Money Plus Premium, most recent version On the old accounts, turn off on-line updates. You should then be able to merge the old accoun...

Comma Style format, default change
I'd like to change my comma for numbers: 1,000.00 to be 1,000 I can change the style in the toolbar icon (modify), but that only works for the current file. when i open another spreadsheet the toolbar icon puts to two zeros back into the right of the decimal point. HOW CAN I PERM. CHANGE THE COMMA STYLE ICON? DAVE You can change it for any new workbooks that are based on a template. Create new workbook with that style. Then save it in your XLStart folder (location varies with versions of windows & excel). Now each workbook you create new will use that as the default. You co...

Hyperlink to Access record/Form
Hi all, I am trying to solve this issue. Office 2007 / Outlook 2007 / Access 2007 From a Access form I have a command button , send email, the DoCmd send object...How do I also create a hyperlink to this specific email, (the CC is one of my mail boxes), in order to be able to store the hyperlink in the access record, click on it and either open the sent email..or the specific email folder it resides.. Thanks! I don't think it's possible without the Outlook object model. You'd need to instantiate Outlook, create and send the email, and capture the MailItem.EntryI...