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 Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to see list of fields in VBA code window 1

Status
Not open for further replies.

kbinnc

Programmer
Mar 20, 2010
2
US
I'm new to VBA coding and Access. Is there any way to see a list of field names, combo box names, etc in the VBA code window instead of having to remember and/or re-type them? Like I can't even remember the names of my fields, so do I really have to open the table in design mode or some other sort of archaic thing to see the field names? I must be missing something simple.
 
Control + spacebar will pop up intelisense for properties and control names etc.

I don't think access IDE has a way to show field names.
 
I make a popup form with a 2 column listbox. Then I populate it with all table and fields:
Code:
Private Sub Form_Load()
  Dim lst As Access.ListBox
  Set lst = Me.lstFields
  lst.RowSourceType = "value list"
  lst.RowSource = getFldNames
 End Sub

Public Function getFldNames() As String
  Dim tdf As TableDef
  Dim fld As DAO.Field
  Dim strFlds As String
  For Each tdf In CurrentDb.TableDefs
     If Not Left(tdf.Name, 4) = "MSys" Then
        For Each fld In tdf.Fields
           If getFldNames = "" Then
              getFldNames = tdf.Name & ";" & fld.Name
           Else
              getFldNames = getFldNames & ";" & tdf.Name & ";" & fld.Name
           End If
        Next fld
     End If
  Next tdf
End Function
Then I pop it open when I need a table or field name.
 
Thanks CaptainD and MajP... I'll try both. One would think that this is something that MS Access would have built in, but then again, it's not the only thing that makes me scratch my head about Access...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top