Resize ListBox Columns
Just wondering if there's an easy way in Access 2000 to resize listbox columns if necessary to show all information - like you can in a table by clicking, or by the columns autoformatting. Thanks for your help.
Visually listboxes are pretty limited controls, but at least they are native to access - ie anyone with Access should be able to use this control. No problems with distribution, different computers not having a registered listview or datagrid ActiveX control etc.
Here's an example of how to click and drag header edges to resize columns in a listbox - a feature that's sorely missing. If only everyone had names that were the same length...
It's made in an A2K version, but ther's no reason why the code shouldn't be ported to other versions.
It has some API calls to determine the scrollbar position, and I have used a function from Dev Ashish's AccessWeb to get the hWnd of a control.
Open frmTest and place cursor over a collumn edge - it should be pretty intuitive from there.
Hope it may be of use, pm me with any improvements/bugs etc.
Improvements to be made:
Work out how to display something on top of a listbox (easy you would think!) to display a better resize guide line.
Prevent scrollbar returning to leftmost postion if resized when scrolled right.
Wrap code in to a class for easier re-use.
Will you help me with access . I just cant link two
different listbox of the same table namely data format and feature type.
1) if you select Raster in the Data format listbox the
feature type listbox should only allow you to select pixel in it and
2) when you select Vector in the data format listbox the feature type listbox should only allow you to select point,polygon and line only and restrict you from
Does anyone know how to get the columns of a listbox selected item and store it to a string? There is no multi-selection so it should be easier. I tried
s$ = Me.list1.selected but it keeps giving me an error
I have a main report which has details of properties with the following sections / contents:
Page Header - nothing in it but left space on report as printing on headed logo paper.
PropID Header - Just a text box showing 'Property For Rent'
Detail - Showing pictures, address and description of property
PropID Footer - A sub report displaying a list of features of the property
Page Footer - Displaying rental price and contact details if interested.
The sub report to disply in the PropID Footer section is set for 2 columns and when I open it on its own it displays features in 2 columns but when I open the main report it doesn't show as 2 columns but lists in one on the second page.
Basically everything should fit on one page that is the reason I set the sub report to be in 2 columns. When I view the sub report it takes the sub report details onto a second page to list them all.
Can anyone please help as it is driving me mad.
I have NONE set in all force new page, etc., on all reports.
Currently I'm building tables and forms. My first table (called Clients) lists the details of fictional clients. My second table is for invoices.
In my invoices table, I wish to link the column for client reference (note: stored in the Clients table) to the column that precedes it. This column will list the clients’ names and is selected from a drop down list that is linked to the Clients table.
What I want to do (if its possible) is to have the respective client ref. automatically show up in the next cell once I've selected the client to whom the invoice relates?
Am I making sense? Is that possible? If so, how do I do it?
Secondly, how do I do a sum of selected columns for my “totals” column? Basically, I want to add the figures found in several cells that precede it?
I'm affraid my confusing topic title is an indicator of how confused I am by this. I can't even understand the variables well enough to fully utilize Access Help or the Search function here...
What I have is a database hat has column headers that look something like this:
Customer_Name, Order_Date, Qty_Ord, Unit_Price, Total_Price
What I'm trying to get is a query output that will have
Customer_Name, Total Orders (in Dollars) for January, Total Orders (in Dollars) for February, Total Orders (in Dollars) for March, etc.
I've been able to set it up to SUM for one month, but not multiples.
I know I'm totally lame (for proof read any of my previous posts) but you guys totally bailed me out the other time I asked a lame question.
Thanks in advance!
Is there a way to filter a listbox on a subform based on what on another listbox on the main form?
I have a main form that contains a listbox with channels and technology. Each channel has many departments. Each technology impacts different states based on the department. I want to be able to filter down the departments based on the channels. I also have a need based on the departments filtered to do another filtering based on which system the deparment uses to show the states impacted. I'd also like to save this data so that I can retrieve the listbox selections later.
Any help is greatly appreciated.
In the code below, I am looping through Items selected in a listbox (list of attendees I am "adding" to a class). As it loops through the code, I have an option to assign a class "rating" that each attendee gave the class after attending it. Currently, the prompt shows the ID of the item selected, but I would like to instead display the attendee's name (also in the listbox, the next column. Here is my code:
Code: Dim rs As New ADODB.Recordset
Dim varItm As Variant
Dim intRating As Integer
rs.Open "tblClassAtt", CurrentProject.Connection, adOpenDynamic, adLockOptimistic
For Each varItm In lstAttendees.ItemsSelected
intRating = InputBox("Enter Class rating for " & varItm, "Class Rating Entry")
'rs!attendeeID = Me.lstAttendees.Column(0)
rs!attendeeID = Me.lstAttendees.ItemData(varItm)
rs!classID = Me.classID
rs!classRating = intRating
'rs!Request = Me.RequestID
Set rs = Nothing
Currently when the code runs, I get a prompt that says:
"Enter Class rating for 1"
Instead I would like it to say:
"Enter Class rating for Bill"
Hi, I'm new here, so I hope I'm posting this in the correct place. I've searched the forum to see if there are any existing threads that might help me, but I've not found anything that does...
(I think this thread ( http://www.access-programmers.co.uk/forums/showthread.php?t=93444&highlight=Copying+data )may be trying to achieve something similar to me, but I'm a beginner and don't really understand it)
I shall stop waffling! I'm not entirely sure that what I'm trying to achieve is possible, I expect it probably is!
Right, I have a form (frmGroupRegister, which contains exactly the same fields as the table it comes from, tblGroupRegister), which consists of three things:
-GroupDate - The date a group took place on. It is my primary key, as no more than one group occurs on a specific date.
-ParentList (A listbox which contains a query showing the ID number, forename and surname of everyone in a table, tblParentDetails)
-ParentsAttending (A blank listbox)
I would like to place buttons in between the ParentList and ParentsAttending, which would allow users to conduct a 'register' of attendance by copying individual/multiple details from ParentList into ParentsAttending (much like you get when choosing which fields to include in a form when using a wizard for example). I would also like them to be able to remove people from ParentsAttending by using a button in case of accidentally adding the wrong person into the ParentsAttending box.
I'm aware that another, probably simpler way of achieving this would be to use a tick-box system, but I feel that visually, the first method would both look better and demonstrate who is present more clearly.
Any help would be much appreciated, but my Access skills are quite basic and things will probably need to be spelled out for me.
I'm using Access 2000 and Windows XP.
Thanks for your help,
In my db, I have a form set to open on start.
Is there anyway to set this to auto resize Maximize? (if you know what I mean)
"On The Bayou"
Every time I open my database the windows like to resize themselves. How do I remedy this?
I have my switchboard that when opened it looks like pic "switchboard 1" when I use the menu to open and then close any form my switchboard appears like pic "Switchboard 2". I have the code maximise on the on open event of the switchboard.
Do you have any idea on how to get back the switchboard as on the first pic??
Thanks to all
This is a little bit of code I found some time ago. It will resize a form to correspond with the users display resolution. Just add this to a module and call the module on load.
'This modResizeForm module was created by Jamie Czernik 31st March 2000 (email@example.com)
'The module was updated by Dr. Martin Dumskyj 30th January 2001 (firstname.lastname@example.org)
Global Const DesignResolutionX = 1024
'CHANGE THE VALUE ABOVE TO THE RESOLUTION YOU DESIGNED YOUR FORM IN!
Global Const WM_HORZRES = 8
Global Const WM_VERTRES = 10
Dim Width As Integer
Dim Factor As Single 'Used as multiplier for current size properties'
Declare Function WM_apiGetDeviceCaps Lib "gdi32" Alias "GetDeviceCaps" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Declare Function WM_apiGetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As Long
Declare Function WM_apiGetDC Lib "user32" Alias "GetDC" (ByVal hwnd As Long) As Long
Declare Function WM_apiReleaseDC Lib "user32" Alias "ReleaseDC" (ByVal hwnd As Long, ByVal hdc As Long) As Long
Declare Function WM_apiGetSystemMetrics Lib "user32" Alias "GetSystemMetrics" (ByVal nIndex As Long) As Long
Function GetScreenResolution() As String
'returns the height and width
Dim DisplayHeight As Integer
Dim DisplayWidth As Integer
Dim hDesktopWnd As Long
Dim hDCcaps As Long
Dim iRtn As Integer
'API call get current resolution
hDesktopWnd = WM_apiGetDesktopWindow() 'get handle to desktop
hDCcaps = WM_apiGetDC(hDesktopWnd) 'get display context for desktop
DisplayHeight = WM_apiGetDeviceCaps(hDCcaps, WM_VERTRES)
DisplayWidth = WM_apiGetDeviceCaps(hDCcaps, WM_HORZRES)
iRtn = WM_apiReleaseDC(hDesktopWnd, hDCcaps) 'release display context
GetScreenResolution = DisplayWidth & "x" & DisplayHeight
Width = DisplayWidth
Public Sub ReSizeForm(frm As Form)
Dim ctl As Control
'Dim i As Integer
On Error Resume Next
SetFactor 'Call to procedure SetFactor
.Width = frm.Width * Factor
For Each ctl In frm.Controls
.Height = ctl.Height * Factor
.Left = ctl.Left * Factor
.Top = ctl.Top * Factor
.Width = ctl.Width * Factor
.FontSize = .FontSize * Factor
GetScreenResolution 'Call to function GetScreenResolution
Factor = Width / DesignResolutionX
Good day all!
Some time ago, probably in mid 2004, I ran across a post the gave a link to a website that you can download a free image appliation, that can resize any picture.
Unfortunately, I lost the website and now I cannot find the link here. If someone knows the webstie, or another application, please reply.
I have a blank listbox on a form with a 'add' button beside it, once 'add' is clicked a second listbox appears (had visable = false) on click visable = true. The second list has many values listed within it (based on a query), a second button also appears with the list box '<' - with the intention to move values from one list box to the other.
I believe theres a 'MoveLeft' command that will move the values from one listbox to the other?
Will moving the values update the query? ie. its its moved once the value will not be visable in the second listbox again? As I dont want this to be the case I want to to copy the value to the first listbox rather than remove it from the query
I have been running 2003 on XP SP2 for some time but a couple of days ago I needed to do a 'detect and repair' on Word but without resoring defaults. When I opened Access, the Properties Window was back to its default (small) size and couldn't be resized. An uninstall/reinstall made no difference.
Has anybody got any idea what might have happened and what I can do to put it right? I usually have it the height of the screen and this is driving me nuts!
Ok, this seems really lame to have to post this but in Access2007 none of my form or table windows have Mininize, Maximize, or the ability to resize. There is a Close X but nothing else. Being used to Access2003, I am used to being able to resize the windows or at least minimize them. The properties panel has control for these items but they do not appear when I set the properties to yes.
I need to expand a form on button press, am using the following code with a toggle button to resize form, depending on the toggle state of the button. Hence :
If tglDetail.Value Then
nOrgWidth = Forms![WIP Update].Width
DoCmd.MoveSize , , nOrgWidth + 700
DoCmd.MoveSize , , nOrgWidth - 3800
As I understand it - the values shown are in twips and although the numeric values do not match to restore the form to its original size when the button is reset - this works perfectly.... (not too sure why-any ideas?)
The main problem is : when the form width increases, I am concerned that users with a reduced screen resolution to me may not see the edge of the form and so I need to center the form on the screen when the toggle button is pressed as the form is resized. Any ideas on how I can do this please (am using '97) ?
Whilst at college was positive there was some coding, to automatically re-size the form when opening?? can anyone help with this, have spoken to a few people and they say to change in design view but i am finding this annoying. Any help would be appreciated.
Moves and/or resizes the named form in units of Twips (1 twip = 1/1400 inch)
Moves and/or resizes the named form in units of Twips. A Twip is a Windows unit of measurement. The conversion formula is 1 twip = 1/1400 inch. This procedure gives a greater amount of accuracy in moving and sizing forms than the related FormMoveSizeInches() procedure. The form named by the strForm parameter must be open for this procedure to work. To leave a particular sizing/position value unchanged, do not specify a value when calling the procedure. For example, to resize a form, leaving its position intact, specify values for the varWidth and varHeight parameters, and zero-length strings for the varTop and varLeft parameters.
Sub MoveSizeFormInTwips ()
' Example code for FormMoveSizeTwips()
' This example moves the Customers form to
' a position approx 1 inch down and approx 1
' inch to the right of the Access window
Dim bOK As Boolean
bOK = FormMoveSizeTwips ("Customers", 1420, 1420, "", "")
' Now resize the form to be 3 inches wide by 2 inches high
bOK = FormMoveSizeTwips ("Customers", "", "", 3 * 1440, 2 * 1440)
Function FormMoveSizeTwips(strForm As String, varTop As Variant, varLeft As Variant, varWidth As Variant, varHeight As Variant) As Boolean
' Comments : moves and/or resizes the named form in units of Twips (1 twip = 1/1400 inch)
' Parameters: strForm - the name of the form
' varTop - top position of form
' varLeft - left position of form
' varWidth - width of form
' varHeight - height of form
' Returns : True if successful, False otherwise
On Error GoTo err_FormMoveSizeTwips
DoCmd.SelectObject acForm, strForm, False
DoCmd.MoveSize varLeft, varTop, varWidth, varHeight
FormMoveSizeTwips = True
FormMoveSizeTwips = False
?can the size of a subform automatically be resized...?
say, based on the number of records that show in the subform (i.e., 1 vs 10)...?
I'm working on an MS Access app.
The clients use this app with their monitor resolution set to 800 x 600.
Whenever I edit a form I need to set my screen resolution to 800 x 600 to make sure the form is within bounds.:mad:
I wan't a fast way to set the Main Access Window's size too 800 x 600 pixels.
Application.DoCmd.MoveSize(,,800,600) is supposed to work but I get a syntax error.
I have a form without any toolbars etc, that contains the logo of the company. It has to be always on the background. And needs to be the same size as the application window.
I can't maximize the form because that means that my other forms will also be maximized. And they weren't designed for that.
So I would somehow need to get the width and height of the main access window.
somethin like this:
docmd.MoveSize 0,0, acceswindow.width, acceswindow.height
Is there any way to do this?
I know how to maximize a form when it opens, but I was wondering if there isn't a way to actually shrink down the Access app window to specified dimensions when it opens the form? I'm trying to write a dimension-specific app, so there is no distortion what-so-ever. thanks!
The basic idea behind this demo of drag, drop and resize comes from a Russian site here.
In this demo the objects are supposed to be pieces of office furniture but could equally well be used for Gantt charts, reservation systems…whatever seems reasonable.
Designed for 1024x768 but no references are required so it should work okay from A97 to A2007. The little extra space at the bottom of the form is to allow everything to be visible in Windows XP (this was written under Windows 2000 where there is a little more vertical space.)
In case it gets altered in versions later than A97 the Report setup is as follows…
Report width 27cm, detail height 12 cm.
Paper A4 with margins in millimeters…
Top 8, Bottom 8, Left 12, Right 0
However, the report does not match the form exactly, there are places where there is a one pixel difference. The dimensions of the objects are saved as twips but reports and forms appear to handle the conversion slightly differently.
Apart from that, should you have any problems with the demo as posted please PM me and I’ll try to fix it. Should you have any questions regarding its subsequent usage please post those questions in the appropriate forum.
Thanks to all who have tested the form, John, Rob, Alan, Dane, Ace, Gord, Mark (hope I haven’t left anyone out) and of course Lobodava whom I believe is the original author.
As always, have fun and regards,
I am starting up a DB from inside a form in another DB.
The application shell of the started DB does not start up maximized, is there any conrtrol i have over that?
Is there a possibility that when you a form, it will automatically resize based on the screen resolution you have.
For example, I have a 17" monitor on which the form looks great. However, when I opened it at 21" monitor, the form looks too small.
Any idea about this ?
I understand that Access 2007 will have a new feature which enables to resize controls to fit the user screen selected resolutions. I think this is a step in the right direction. Unfortunately it does not scale the font size like the code Ken Getz published in his book. I am using his resize code, but is it very complex and I would prefer to use a native functionality of Access if I could. As of now, the new functionality is not sufficient for my purposes. I hope they continue to develop it.
Just my 2 cents
I would like to read other users comments on this.
Depending on circumstances I want to resize the detail section and perhaps reposition some of the controls on my form. When I change the detail height property in code my change is ignored. The same is true when I try to move a control to new position by changing the top or left property. My intention is to change the height of the detail section to either 3.00 or 4.00 inches. Is this even possible once the form has been opened?
If booSelected Then
Me.Detail.Height = 4.00
Me.Detail.Height = 3.00
I have a form that contains a lstResults list box. I have an event on the OnSize event of the form that dynamically resizes the lstResults to be the same width and height of the form.
Me.lstResults.Width = Me.InsideWidth
Me.lstResults.Height = Me.InsideHeight
I want to resize the lstResults.ColumnWidths so the 1 visible column changes based on the size of the form.
Me.lstResults.ColumnWidths = "0;Me.InsideWidth;0"
This does not work.
What is the correct way to do this?
I need to know how to auto resize form sizes based on screen resolution.
I have a standard menu, and want to press a toggle button to widen the form to show the rest of the menu which is hidden. The form is not resizable and does not have scroll bars. I can not find the finction to widen it. is it possible?
At the moment I have an ugly second form window to show the extended menu.