Access Form Text Boxes (3 Questions) (1 Viewer)

stu_c

Registered User.
Local time
Today, 13:38
Joined
Sep 20, 2007
Messages
489
Hi all
hope your all keeping safe during these strange times!
wonder if you can help with three questions below :)

1: I have a form with 50 odd text boxes and depending on the drop down choice at the top I want them to be greyed out or not if the field names were for example:
Txtbox01
Txtbox02
Txtbox03
Txtbox04
etc
is there a way to group these all under one name for coding purposes? eg. group them as AllFieldChoices rather than having to type out 50 odd field names every time but also to make it look clearer?

2. I have one field that picks up information from several fields above and puts is all into a summery at the end, I need some in higher CASE and some in Lower case, is there a way to make the first letter in the Lowercase field a capital?
=LCase([OfficeLocation].[column](1)) & " " & UCase([StaffDetails].[column](2))

3. Final Question!!, I have forced most fields do be Capitals using the > feature on the properties sheet, Issue I have when a user clicks into a field that a previous person filled in lower case it reverts back to lower case, is there a way for this to be forced to change on the table into Higher case so it wont keep reverting back table name is
TBLCarfDetails with MAKE and MODEL fields
 

isladogs

MVP / VIP
Local time
Today, 13:38
Joined
Jan 14, 2017
Messages
18,186
1. Suggest you use the Tag property to disable a group of controls with one line of code. See my example app Set Controls
2. Use the Strconv function with vbProperCase argument. See https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/strconv-function
However this will capitalise the first letter of each separate word
If you don't want that, try UCase(Left(your string here, 1) & Mid(your string here,2)
3. Use an update query setting the field to UCase(your field name)
 

Gasman

Enthusiastic Amateur
Local time
Today, 13:38
Joined
Sep 21, 2011
Messages
14,041
Re Q3, all that does is display as capitals, until as you found out, you enter the control, where it shows the true value.?

You would need to uppercase the data in the afterupdate or lostfocus event of either the controls or the beforeupdate of the form?
You would of course need to update the field in the table to Uppercase for previous entries.

I chose to use the lostfocus event in one of my DBs
Code:
Private Sub Initials_LostFocus()
Me.Initials.Value = UCase(Me.Initials.Value)
End Sub

Note the .Value property is not required, but this was created before I knew better. :)

HTH
 

Uncle Gizmo

Nifty Access Guy
Staff member
Local time
Today, 13:38
Joined
Jul 9, 2003
Messages
16,244
1: I have a form with 50 odd text boxes and depending on the drop down choice at the top I want them to be greyed out or not if the field names were for example:

Colin provides a link to his excellent code using a Controls Tag property.

As an alternative to using the tag property of the control, you can put the controls that you want to group into a container.

Nifty Container

 
Last edited:

stu_c

Registered User.
Local time
Today, 13:38
Joined
Sep 20, 2007
Messages
489
thanks guys ill have a play later!
 

Users who are viewing this thread

Top Bottom