I have created a subform that contains a datasheet. I need to control which columns display and need to assisgn suitable labels on the form so I have created a table with the relevant data and I am using the following code in the ON LOAD event. I have renamed all the Labels as "Label" followed by the variable name. When I step through the code it seems to work but when the form displays the label names have not changed. Can anyone help me figure out what I am doing wrong?
Private Sub Form_Load()
Dim rs As Recordset
Dim sSql As String
Set rs = CurrentDb.OpenRecordset("SELECT tblAbbreviations.* FROM tblAbbreviations ORDER BY Sequence;")
sSql = "SELECT "
Do Until .EOF
Me.Controls("Label" & !FieldName).Caption = Nz(!Abbreviation, !FieldName)
Me.Controls(!FieldName).ColumnHidden = Not !Show
Set rs = Nothing
Sometimes MS breaks things just for fun...
In Access 2003, only the maximum allowable SQL string length could cause problems as you built a recordset.
Now, when using string data in a WHERE clause, the 'identifier' maximum is 128 characters.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…