Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Format Datasheet

Status
Not open for further replies.

Underling

MIS
Jul 30, 2002
17
AU
Hey guys.

Well this is a new on for me, the idea is this.

By using a datasheet view in a subform and a custom popup menu I can allow users to filter down to the records they wish to view, in whatever order they want, and then allow them to open/edit said records with a Double-Click Event.

Fact is there are so many ways that different departments wish to filter this works in theory and in a sample I have created. A search or filter form would be huge. This seems simpler.

Ok, all good in theory, I can restrict “new” and “edit” etc, but I can just see users resizing the datasheet view to something only brain dead users could do or hiding columns. <SHUDDER>

So my question is, can or is there some why that I can use the OnOpen or OnLoad event to re-size the datasheet to a default size? (Well the fields in the datasheet mainly) This would allow you average bi-polar user to mess and re-size until their coffee mugs run out and the next user doesn’t get left a mess. (Which would then force them to ring me!) <SHUDDER>

I hope this makes sense, I really hope someone can point me in the right direction.

If you have any questions just ask and I will try to make myself clear.

Thanks :)
 
I often wondered that myself. I have a project I am working on where this would be useful and have not found an answer either. I have been looking but no luck. Hopefully someone can answer for us both.
 
How are Underling . . . Ascentient . . .

The users wont be able to resize anything, but you can easily [blue]make a continuous form that looks exactly like a DataSheet![/blue]

[purple]Unless there's some API available, this is as close as your gonna get . . .[/purple]

Calvin.gif
See Ya! . . . . . .
 
Would the following code in the OnLoad or OnOpen event of the SubForm work for what they are asking for?

Dim x As Long

For x = 0 To Me.Controls.Count - 1
If Me.Controls(x).ControlType <> acLabel Then
Me.Controls(x).ColumnHidden = False
Me.Controls(x).ColumnWidth = 2500 '-2 sets to auto fit
End If
Next

End Sub
 
How are ya crobg . . . . .

In single/Continuous form view yes. [blue]Not Datasheet view![/blue] In datasheet view you loose alot of form functionality.

Calvin.gif
See Ya! . . . . . .
 
Thanks guys.
And thanks Crobg for the hint I needed to work this one out.
You can define each column width on open. Which is what I have done.

Private Sub Form_Open(Cancel As Integer)
Me.lngsubID.ColumnWidth = 0
Me.fklngMain.ColumnWidth = 0
Me.strsubtext1.ColumnWidth = 3000
Me.strsubtext2.ColumnWidth = 2500

End Sub

Hope this helps someone :)
 
Actually both methods help me. I had played with the continous form idea before, but did not really like it, though I didn't have much time to really "dig" in to it.

Either way would definitely work though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top