Results 1 to 5 of 5
  1. #1
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    148

    ComboBox selection to enter into new record (not to retrieve existing record)

    Hi Expert,



    I have a main form with recordsource from 1 table. This form contains fields such as quote no, quote desc, opportunity desc etc. which is used to create a new quote for an opportunity in our company.

    I have a Combobox in this main form that displays opportunity description, which comes from an opportunity table. My objective with this opportunity combobox is to enter the opportunity desc for new quote entry. For instance, I want to enter these values when new quote is created in my main form (fields - quoteno, quote desc, opportunity desc selected from combobox, etc......)

    In this main form, I have a command button to Add new quote, when I click this button, all the records are ready for new entry. However, one problem I have is when I select value from the opportunity combobox, it opens up the existing record for quoteno, quote desc, etc. in the main form, it doesn't enter opportunity desc corresponding to new quoteno. I want this combobox to enter the selected value for the new quote entry.

    I am not too conversant with SQL, so cant understand what's behind the scene. Any help would be highly appreciated. Thank you.

  2. #2
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    when I select value from the opportunity combobox, it opens up the existing record for quoteno, quote desc, etc. in the main form,
    It sounds as if the combo box has some code in its After Update event that is executing a search. Can you post the code for the After Update event (or any other event) of that combo?

  3. #3
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    148
    John_G - This is the code I have in After Update event of the combo box. Query 1 in this code is used to run an Append Query in the Subform within my main form to copy record from a table. I didn't get the error messages in the code and not sure how its performing the search in my Main Form. Thank you for any possible help.

    Private Sub CmbOppList_AfterUpdate()
    On Error GoTo CmbOppList_AfterUpdate_Err
    ' _AXL:<?xml version="1.0" encoding="UTF-16" standalone="no"?>
    ' <UserInterfaceMacro For="CmbJobList" Event="AfterUpdate" xmlns="http://schemas.microsoft.com/office/accessservices/2009/11/application"><Statements><Action Name="Requery"><Argument Name="Cont
    ' _AXL:rolName">CmbOppList</Argument></Action></Statements></UserInterfaceMacro>
    DoCmd.OpenQuery "Query1", acViewNormal, acEdit
    Me.Requery
    Me.Refresh
    CmbOppList_AfterUpdate_Exit:
    Exit Sub
    CmbOppList_AfterUpdate_Err:
    MsgBox Error$
    Resume CmbOppList_AfterUpdate_Exit
    End Sub

  4. #4
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    It LOOKS like that code is from a converted macro, but it doesn't matter. Because you are using that combo box to select a piece of data to be entered in to a field in a new record, the After Update doesn't need to do anything. As long as the combo box has the table field as its control source, and you are saving the correct column of the combo, it should work with no code required.

  5. #5
    sud2017 is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Jul 2017
    Posts
    148
    So I believe the things I have to check is 'row source' and 'control source' of the combobox? Is there anything else that might cause my combobox to perform 'search' than 'store' value to a field in a new quote record? I don't have access to my db now but as far as I remember I have correct row source (from the Opportunity table) and the control source is the FK in my quotes table. Thanks you for any possible help.

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

Similar Threads

  1. Replies: 1
    Last Post: 04-13-2016, 09:02 PM
  2. Replies: 12
    Last Post: 05-14-2015, 03:48 PM
  3. Replies: 2
    Last Post: 03-01-2012, 03:11 PM
  4. Combobox selection updates Table record
    By lucky in forum Access
    Replies: 4
    Last Post: 10-30-2011, 10:44 AM
  5. Replies: 0
    Last Post: 02-25-2011, 09:40 AM

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