Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Access Database - Unable to force a datasheet form to have a fixed width for text box.

Posted on 2007-11-23
10
Medium Priority
?
1,131 Views
Last Modified: 2013-12-05
I have a form.  On this form there is a subform.  On this subform there is another form that is a datasheet.
My problem is this:  How can I force the width of the text box on this datasheet to be a certain size without code and the accompaning overhead.  Basically the user can fiddle until the column width is 0 thus the field will no longer show.  

I coded a Current Event (see below) but it seems this is a lot of everhead.  BTW - this is an unbound .adp against a SQL Server - so I am looking for the least overhead possible since this thing is getting hit by 250 users.

Private Sub Form_Current()
    Forms!frmMain.frmA.Form.Controls(0).ColumnWidth = 500
    Forms!frmMain.frmA.Form.Controls(1).ColumnWidth = 2000
End Sub
0
Comment
Question by:michaelrobertfrench
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 44

Assisted Solution

by:GRayL
GRayL earned 400 total points
ID: 20340666
What you have written will set the column widths of the first two controls in the first subform, not the second. For that:

Private Sub Form_Current()
    Forms!frmMain.frmA.Form!frmB.Form.Controls(0).ColumnWidth = 500
    Forms!frmMain.frmA.Form!frmB.Form.Controls(1).ColumnWidth = 2000
End Sub
0
 

Author Comment

by:michaelrobertfrench
ID: 20340692
Actually I perhaps had my form - subform - datasheet a bit mixed up. Thanks for the clarity.
But that aside, the VBA with the .columnwidth property is what I am trying to avoid but see no property in the User Interface where I can set the width and have it retained.  Do you know how I can set the width without the overhead of code?
0
 
LVL 44

Expert Comment

by:GRayL
ID: 20340843
In Access, if you adjust the widths of a query in datasheet view and then save the query, when the query is re-run, the column widths are retained from the previous save.  This help?
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:michaelrobertfrench
ID: 20340921
Access .adp unbound forms - forms are populated with stored procedures.  Still needing to know how to hardcode the width of the text box without VBA.
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 20341698
michaelrobertfrench,

"hardcode"... "without VBA"

Isn't that an Oxymoron?
:)

Anyway...

If you don't want your users to "fiddle" with the column widths, then you could change the SubForm's DefaultView Property to: "Continuous Form" (Tabular).
Then squeeze all the controls together Horizontally, so they touch.
Then get rid of even the smallest empty spaces in the Detail Section of this subform.

This will create the illusion of Datasheet view, however, users can’t "fiddle".
;)

(The above technique is pretty standard here at EE)

Another benefit to this technique is that users will now be seeing the Caption Property of the Field, instead of the actual FieldName. (You can even change the text in the label to whatever you want)
So users will see: “Customer First Name” instead of “CUST_FN”

Hope this helps as well

JeffCoachman
0
 
LVL 74

Assisted Solution

by:Jeffrey Coachman
Jeffrey Coachman earned 700 total points
ID: 20341700
michaelrobertfrench,

"hardcode"... "without VBA"

Isn't that an Oxymoron?
:)

Anyway...

If you don't want your users to "fiddle" with the column widths, then you could change the SubForm's DefaultView Property to: "Continuous Form" (Tabular).
Then squeeze all the controls together Horizontally, so they touch.
Then get rid of even the smallest empty spaces in the Detail Section of this subform.

This will create the illusion of Datasheet view, however, users can't "fiddle".
;)

(The above technique is pretty standard here at EE)

Another benefit to this technique is that users will now be seeing the Caption Property of the Field, instead of the actual FieldName. (You can even change the text in the label to whatever you want)
So users will see: "Customer First Name" instead of "CUST_FN"

Hope this helps as well

JeffCoachman
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 20341712
^That time, without the crazy characters!
.\_/.
0
 
LVL 44

Accepted Solution

by:
Leigh Purvis earned 900 total points
ID: 20343380
Stephen Lebans Auto Column width (and datasheet column freezing).
http://www.lebans.com/autocolumnwidth.htm
0
 

Author Closing Comment

by:michaelrobertfrench
ID: 31410708
As far as I can determine - the vba must exist in order for the screen to have described properties.  Thanks
0
 

Author Comment

by:michaelrobertfrench
ID: 20856160
Thank You
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…
Suggested Courses

877 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question