MS Access Not Displaying Fields on Form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • munrrob
    New Member
    • Oct 2006
    • 1

    MS Access Not Displaying Fields on Form

    MS Access 2002 SP 3

    I have two forms, one with a combo box looking at available lookup tables and the other an unbound form which will be used by the user to update lookup values.

    The lookup value tables all have the same format: ID, Value, ValidFrom, ValidTo

    The code I use to get the form to look at the correct lookup value table is:

    Dim db As Database
    Dim tdfTable As TableDef
    Dim strTableName As String

    strTableName = Me![cmbLookupTables].Value

    Set db = CurrentDb()
    Set tdfTable = db.TableDefs(st rTableName)

    If IsNull(Me![cmbLookupTables]) Then
    MsgBox "No selection."
    Else


    DoCmd.OpenForm "frmLookUpTable sAdministration "

    'Get the fields for the SQL query
    Dim strID As String
    Dim strValue As String

    strID = tdfTable.Fields (0).Name
    strValue = tdfTable.Fields (1).Name

    Forms!frmLookUp TablesAdministr ation.Caption = "Edit List for " & Me![cmbLookupTables].Column(1)


    Forms![frmLookUpTables Administration].RecordSource = "SELECT [" & strID & "] AS tblID,[" _
    & strValue & "] AS tblDescription,[" _
    & strValidFrom & "],[" _
    & strValidTo & "]" _
    & " FROM " & strTableName & ";"
    Forms![frmLookUpTables Administration].Requery
    Forms!frmLookUp TablesAdministr ation.Repaint
    Forms!frmLookUp TablesAdministr ation.Refresh
    End If


    The values on the edit form are being set correctly and the correct number of records returned. However, the fields are not visible (have checked the visible property is set to yes) even though in the properties window I can scroll through each field and check the properties have been set correctly.

    Any ideas where I am going wrong?
  • PEB
    Recognized Expert Top Contributor
    • Aug 2006
    • 1418

    #2
    Hi,

    You need to set the control properties of your fields to visualize your data..

    Each field has own name!

    So

    Me!Field1.Contr olSource=/the name of the field from your table def/


    :)

    Comment

    Working...