Adjusting column sizes of grid view form

  • Thread starter Thread starter BobRoyAce
  • Start date Start date
B

BobRoyAce

I have a form that is in gridview format. How do I set the column widths for
the columns in the view? I tried setting the width properties for the fields
contained in each column but they seem to be ignored.
 
If you are using the form as a datasheet view, then the column sizes are
going to be settable by the user.

If you have the form open in a continuous form (not datasheet view), then
the size of your fields that you place on the form is used.

I prefer the continues form view. However, this view does mean that the
up/down arrow keys do NOT behaving like they do in Excel (or, fact how they
should in my opinion!). The solution is a nice little piece of code I use
for all my continues forms to fix the key problem.

By the way, I think that continues forms are a fabulous feature of
ms-access. Here is some neat screen shots of using continues forms in
ms-access. I sure the following will give you some ideas:

http://www.attcanada.net/~kallal.msn/Articles/Grid.htm
 
I use the following:

(you also have to set the forms key-preview to yes in the events tab.

Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
' key hand

Select Case KeyCode

' Case vbKeyEscape
' KeyCode = 0
' DoCmd.Close

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext

' Case vbKeyReturn
' If IsNull(Me.ID) = False Then
' KeyCode = 0
' Call EditMain
' End If

End Select

End Sub

I also usually make the Enter key open up a form to view/edit the details.
You can see the above code, but I have it commented out. The same goes for
the Esc key example above hat exits the form. You can actually remove the
extra code above, as all you need to enable the arrow keys is:

Case vbKeyUp
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acPrevious

Case vbKeyDown
KeyCode = 0
On Error Resume Next
DoCmd.GoToRecord acActiveDataObject, , acNext
 
Back
Top