Syntax Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • simulationguy
    New Member
    • Feb 2010
    • 27

    Syntax Question

    what is the syntax for just accessing database fields from vba ?
    i.e I have a table of equipment and one field in the description. I have a command button on a form go to the vba and try getting the value of my field

    I've tried tblEquipment.De scription, tblEquipment("D escription") and about a dozen other iterations.

    its gotta be something easy
  • ADezii
    Recognized Expert Expert
    • Apr 2006
    • 8834

    #2
    Your question is a little vague. I'm sure that you have have several Records in tblEquipment which contain Values in the [Description] Field. Which Value, in particular, are you tryinig to access?

    Comment

    • simulationguy
      New Member
      • Feb 2010
      • 27

      #3
      I have a main form and the record selected that I want I just want to pass the value for one of the fields to my vba code.

      What I am trying to do is assign equipment records to a location but there are several equipment records that have a common group field and the client wants to be able to add all of the equipment records in a group at one time instead of adding them individually. So I have a command button and a pick list that lets the client select a group and then push the button and I can loop through the equipment list find all the records in the group and add them to a junction table (many to many relationship)

      But I need to pass in the location ID field which is already selected in the form.

      (short story long)

      Just looking for the syntax to access a field in a table.

      Comment

      • ADezii
        Recognized Expert Expert
        • Apr 2006
        • 8834

        #4
        The correct syntax, assuming the Field Name is Location ID, is:
        Code:
        <YaDa - YaDa> = Me![Location ID]

        Comment

        • simulationguy
          New Member
          • Feb 2010
          • 27

          #5
          Syntax Question

          THANKS!!! exactly what I was looking for I kept trying to get the table name in there somehow.

          Comment

          Working...