473,757 Members | 9,145 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Datasheet Subform - Change the width of a column

I have a subform that displays a datasheet. There are a couple of
different queries that can be displayed in the datasheet. The queries
are available in a combo box on the main form. The problem I am
having is that when I change the query all the column widths remain
the same. This doesn't look very good. I can't figure out a way to
set the column widths.

I have tried..

Subform.control s(Name of Column).columnw idth = IntColumnWidth

However, It doesn't change the width of the column in the subform and
if I debug.print Subform.control s(Name of Column).columnw idth i dont
get a value equal to IntColumnWidth

it just gives me whatever the current width size is.

Thanks for any help.
Nov 12 '05 #1
3 3343
Sometimes the easy way to fix this is to have 2 subforms ( 1 for each query)
sitting on top of each other. Then you just need some code in the combo after
update like -
if combo = something
then
Me.subform1 visible = true
me.subform2 visible = false
etc
HTH
David B

A Clark <ag*********@ho tmail.com> wrote in message
news:32******** *************** ***@posting.goo gle.com...
I have a subform that displays a datasheet. There are a couple of
different queries that can be displayed in the datasheet. The queries
are available in a combo box on the main form. The problem I am
having is that when I change the query all the column widths remain
the same. This doesn't look very good. I can't figure out a way to
set the column widths.

I have tried..

Subform.control s(Name of Column).columnw idth = IntColumnWidth

However, It doesn't change the width of the column in the subform and
if I debug.print Subform.control s(Name of Column).columnw idth i dont
get a value equal to IntColumnWidth

it just gives me whatever the current width size is.

Thanks for any help.


Nov 12 '05 #2
A Clark wrote:
I have a subform that displays a datasheet. There are a couple of
different queries that can be displayed in the datasheet. The queries
are available in a combo box on the main form. The problem I am
having is that when I change the query all the column widths remain
the same. This doesn't look very good. I can't figure out a way to
set the column widths.

I have tried..

Subform.control s(Name of Column).columnw idth = IntColumnWidth

However, It doesn't change the width of the column in the subform and
if I debug.print Subform.control s(Name of Column).columnw idth i dont
get a value equal to IntColumnWidth

it just gives me whatever the current width size is.

Thanks for any help.


I do something like this. On the fields I want to Hide, in the Tag I
put -1. Where I want the default width, I put a 0. If I want SizeToFit
I leave empty

Sub SizeDS
Dim ctl As Control
For Each ctl In Me.Controls 'change to something like

If ctl.ControlType <> acLabel Then
Select Case ctl.Tag
Case "-1"
ctl.ColumnHidde n = True
Case "0"
'default size
ctl.ColumnWidth = -1
Case Else
'size to fit
ctl.ColumnWidth = -2
End Select
End If
Next
End SUb

On the OnOpen event I could enter
SizeDS

If you want to specify a specific control from the main from try
something like
Me!SubFormName! Control.Whateve rProerty = ...

Nov 12 '05 #3
ag*********@hot mail.com (A Clark) wrote in message news:<32******* *************** ****@posting.go ogle.com>...
I have a subform that displays a datasheet. There are a couple of
different queries that can be displayed in the datasheet. The queries
are available in a combo box on the main form. The problem I am
having is that when I change the query all the column widths remain
the same. This doesn't look very good. I can't figure out a way to
set the column widths.

I have tried..

Subform.control s(Name of Column).columnw idth = IntColumnWidth

However, It doesn't change the width of the column in the subform and
if I debug.print Subform.control s(Name of Column).columnw idth i dont
get a value equal to IntColumnWidth

it just gives me whatever the current width size is.

Thanks for any help.


From the main form I use:

'Code from somewhere on comp.databases. ms-access:
MySubform.Form. MyColumn1.Prope rties("ColumnWi dth") = 1000 '1440 Twips
per inch
MySubform.Form. MyColumn2.Prope rties("ColumnWi dth") = 880

This should allow you to change the Column Widths for the different
queries. I put these commands between the MySubform.Form. Refresh and
the MySubform.Visib le = True in my case.

If I use multiple subforms sometimes having a subform with a caption
that simply says "Updating, please wait...." allows me more
flexibility in updating tables via code when bound controls on the
subforms are used. I also like to see if the underlying query results
in any records so that I can show something more interesting than a
blank line.

Also, be aware that if you decide to convert your database containing
subforms to VB you may have to get creative.

James A. Fortune
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5359
by: ivan | last post by:
I have a form (CustomerImfo) that has a subform within it (order). Within that subform is another subform (OrderDetail). That subform (OrderDetail) is displayed in Datasheet view. When I am entering customers and their respective orders, the first order entered is fine with the "tab" field orders correct. On the second and subsequent orders, when I go from the Order form to the subform "OrderDetail", the curser goes to the wrong field...
3
13423
by: A Clark | last post by:
I have a subform that displays a datasheet. There are a couple of different queries that can be displayed in the datasheet. The queries are available in a combo box on the main form. The problem I am having is that when I change the query all the column widths remain the same. This doesn't look very good. I can't figure out a way to set the column widths. I have tried.. Subform.controls(Name of Column).columnwidth = IntColumnWidth
3
3615
by: Paul T. Rong | last post by:
I have a listbox (of product names) control on my form. I want to pass the selected item (a product name) to a subform, and the product unitprice should apear automatically next to the product name in the subform. Is it possible? How do I do this? Thanks in advance. Paul from Slovakia
1
2323
by: Richard Sherratt | last post by:
I added a new field to a table in the tables database. In the code database, I added a new column for the new field to a datasheet subform. I opened it in datasheet view and moved the column to the position I wanted it. No records are returned by the form's query (it has a "Where ID = -1" clause and the GoToRecord proc on the main form changes the subform's recordsource). When I opened the form and started adding data to the subform,...
2
4064
by: Arnie | last post by:
I have searched this NG for datasheet column width posts and have read many of them. None of them seem to address what I would like to do. I'm beginning to think what I want can't be done. Here is what I would like: I have a datasheet form with five columns. The third column is a combobox with two visible columns. The final displayed value and bound column is column 1. The width of the third datasheet column is wide enough to see...
1
7007
by: Thomas Zimmermann | last post by:
I have a form with a subform in datasheet view. Now, I want to trigger a procedure (P1) each time the user selects an entire column (by clicking in the heading) in the subform. The procedure (P1) I want to trigger needs to be called with the selected column as a parameter. As far as I am aware, there is no event procedure for clicking in the heading of a datasheet. So insted I need to start by having an other procedure P0, which is...
5
7357
by: deekay | last post by:
I want to allow users to resize and reposition columns of a datasheet but for a prompt to be brought up and only the layout only to be saved if they select "save changes". This is the way it works at the moment for queries but for datasheet forms I find that it automatically saves column positions and widths without prompting to save changes. I should mention i am using Access 2000
12
6714
AccessIdiot
by: AccessIdiot | last post by:
Hello all, I have a subform that I want to be in datasheet view to be able to add multiple records. I have dragged and dropped the fields from the field list window and set the font to what I want. However, when I view the form the subform is in a default font and the column widths are not long enough to hold the names. How can I change the font and the column width? thanks for any help
1
2968
by: tom taol | last post by:
Currently, there are 3 datasheets in a form. and, i changed column widths of each form(datasheet type) by the way, there is not keep the column width in ms access. for example, i close the form, open the form again... the width of the form is not keep.... I want to apply column widths of a form lately. *** Sent via Developersdex http://www.developersdex.com ***
5
11034
by: Deano | last post by:
I have five subforms each living in a page on a tab control. Each form is in datasheet view. The time has come to resize both the forms and the subforms. I am able to change the column widths in the first subform and these are remembered. However the column widths for all the other subforms change back to their original widths when I re-enter the form. I have no idea why this is and I have checked that all the form properties are...
0
9298
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
9885
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9737
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7286
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6562
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5172
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5329
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3829
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.