473,729 Members | 2,345 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 13420
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

1
8871
by: Marble | last post by:
Hi all: In DB2 CLP mode ,how to change a column name expect to recreate a table? Thanks . Your friends.
3
3343
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
15950
by: Thelma Lubkin | last post by:
I'm resubmitting a question that went unanswered a while ago. I'll try to rephrase it. I have a hierarchical form that presents data on an 'organization'. It has 2 subforms, the first a datasheet view of all the 'members' of the organization, and the second, detailed information for the 'member' selected in the datasheet subform. When user selects an organization , the resulting view gives the information on that organization followed...
10
13392
by: Michael R | last post by:
Hello to all. In what way can I update a certain selected records' values on a datasheet subform using a command button which is located on the main form? Thanks and cheers.
4
4945
by: paulw4 | last post by:
I have a mail form that has a datasheet subform, there can be up to sixty items in the datasheet. The data sheet has three fields: AttID, AttName, AttYN The object is for the enduser to select attributes, that relate to the contact on the main form. Below is the code I have been working with to read all the attributes checked "Yes". The intent is then update/append the cntID from the main form, the attID and attYN value into a linked table....
0
3151
by: WPW07 | last post by:
Hello Everyone, I stumbled onto something interesting and was wondering if anyone else has experienced it and how they fixed it. I've posted to several forums to no avail. I've got a datasheet subform developed in an Access 2003 database. Users can click on a row and delete the record on the datasheet. However, when we open the database using Access 2007, Access 2007 sets autofiltering on each column, so I can't select the row--only
4
5205
WyvsEyeView
by: WyvsEyeView | last post by:
I am doing the very standard thing of filtering the contents of one combo box based on another combo box. I've done it many times, but always on a main form. Now I'm trying to do it on a datasheet subform and it is not working. After making the selection in the first combo box, when I move to the second combo box, I get the Access input parameters box. If I input the value that is in the first combo box, I get the expected results in the second...
3
3003
by: pzh20 | last post by:
I have an unbound form/subform where I populate a combo box on the main form, and using the onchange event, display fields from a table in a datasheet subform. I want to add a new record via the subform, allowing the user to type certain fields but complete other fields via code in the beforeinsert event as follows Private Sub Form_BeforeInsert(Cancel As Integer) Me.Kitchen = Me.Parent.Kitchen(2) Me.lookupRoute = Me.Parent.Kitchen(1) ...
7
7262
by: MayoM | last post by:
Access 2003 has suddenly reordered the sequence of columns in a datasheet subform. Specifically the last column has stayed in place but the others are back to front. There are about 50 columns in total. Any ideas as to what is causing this? And what is a permanent solution? I had a assumed that the sequence was taken from the sequence of the columns in the query in the form's record source. But as this hasn't changed I don't know if...
0
8917
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8761
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
9200
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
8148
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
6722
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
6022
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
4525
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
4795
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2680
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.