Results 1 to 6 of 6
  1. #1
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314

    Updating a field from a combo box column(2) in a form.

    I have a combo box for selecting individuals in forms for several transaction tables. It contains the Primary ID in Column(0) [which is hidden], Name in Column(1) and an Amateur Call Sign in Column(2). In several forms, I create an On Click event to store the person's ID into a transaction record, using the code:

    Private Sub Liaison_Ag_Click()
    Member_ID = Liaison_Ag.Column(0)
    End Sub

    This works fine, but I would also like to store the Call Sign into its corresponding field, but when I add the line:
    Call = Liaison_Ag.Column(2), Access complains. Shouldn't this work?

    Private Sub Liaison_Ag_Click()
    Member_ID = Liaison_Ag.Column(0)
    Call = Liaison_Ag.Column(2)
    End Sub



    I have been able to do a work-around for this, by adding the member table to the query and making the member call sign available. However, I would like to understand what the issue is here. It would seem reasonable that each column in a combo box should be able to be manipulated.

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows 10 Access 2010 32bit
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    It would be helpful to readers if you would show us your tables and relationships (jpg of relationships window).

  3. #3
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    Code:
    Call = Liaison_Ag.Column(2)
    Call is a keyword and probably a poor choice for a field name.
    Access complains.
    whats the error?

  4. #4
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    Here is the Relationship chart. I have temporarily turned off Referential Integrity for many of the relationships, as I work through development of the database.
    It includes the following transaction tables: Activities, Liaison, Assets_Trans, and Mem_Trans. The two primarily involved with this issue are Activities and Liaison.

    Liaison has two combo boxes. One selects the individual and the other selects the Events.
    In context of the Event
    Portions of the Activities table is used in a sub-form in context of the Events, embedded with its Events parent form. From this context, the Member Combo box is used to select the individual from the Members table.
    In context of the Member
    Portions of the Activities table is used in a sub-form, embedded with its Members parent form, which includes the Events Combo box for selecting an Event to link the individual to.

    While I usually add records to the Activities table from the context of the Events table, I can also do it from the Members context, when it is convenient to do so.

    The Liaison assignments work similarly.Click image for larger version. 

Name:	Relationship Chart.JPG 
Views:	7 
Size:	122.7 KB 
ID:	32598

  5. #5
    WCStarks is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Sep 2016
    Posts
    314
    After the one comment that "Call" was also a keyword in Access, I tried placing []s around the field name and it now works. I guess it pays to always use the []s when referring to field names. Sorry for the trouble.

  6. #6
    moke123's Avatar
    moke123 is offline Me.Dirty=True
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Ma.
    Posts
    1,654
    I guess it pays to always use the []s when referring to field names
    Personally I hate brackets but sometimes they're a necessary evil.
    Even better to avoid the need for them in the first place. I always try to add a prefix (ie. txtCall, lngCall, dteCall, etc) to
    anything that even remotely resembles a keyword.

    here's a fairly long list http://allenbrowne.com/AppIssueBadWord.html
    fyi, you'll note that a few of your field names from the screenshot above appear in the list.
    (group,form,type,transaction )

    glad you got it sorted out.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 12
    Last Post: 02-15-2016, 11:10 AM
  2. Replies: 22
    Last Post: 04-29-2015, 12:33 PM
  3. Replies: 1
    Last Post: 10-19-2014, 03:51 PM
  4. Replies: 5
    Last Post: 07-01-2011, 11:13 AM
  5. combo not updating form
    By cjamps in forum Forms
    Replies: 5
    Last Post: 04-14-2009, 12:00 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums