I have a form that is used to update lookup tables of a format ID, Lookup Value, Valid From, Valid To. I open the form based on hte user selecting the list to amend from a combo box. The code is as follows:
Dim db As Database
Dim tdfTable As TableDef
Dim strTableName As String
strTableName = Me![cmbLookupTables].Value
Set db = CurrentDb()
Set tdfTable = db.TableDefs(strTableName)
If IsNull(Me![cmbLookupTables]) Then
MsgBox “No selection.”
Else
DoCmd.OpenForm “frmLookUpTablesAdministration”
Forms![frmLookUpTablesAdministration].RecordSource = “SELECT * FROM ” & strTableName & “;”
Debug.Print Forms![frmLookUpTablesAdministration].RecordSource
Forms![frmLookUpTablesAdministration].Requery
Forms![frmLookUpTablesAdministration]![tblID].ControlSource = tdfTable.Fields(0).Name
Debug.Print tdfTable.Fields(0).Name
Forms![frmLookUpTablesAdministration]![tblDescription].ControlSource = tdfTable.Fields(1).Name
Debug.Print tdfTable.Fields(1).Name
Forms![frmLookUpTablesAdministration]![ValidFrom].ControlSource = tdfTable.Fields(2).Name
Debug.Print tdfTable.Fields(2).Name
Forms![frmLookUpTablesAdministration]![ValidTo].ControlSource = tdfTable.Fields(3).Name
Debug.Print tdfTable.Fields(3).Name
Debug.Print Me![cmbLookupTables].Column(1)
Forms!frmLookUpTablesAdministration.Caption = “Edit List for ” & Me![cmbLookupTables].Column(1)
Forms!frmLookUpTablesAdministration.Repaint
Forms!frmLookUpTablesAdministration.Refresh
End If
Everything seems to work as I can use tab to go through the fileds and check their properties and the correct number of records are being returned to the form. However, the fields and labels are not visible on screen. Any ideas?