Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    Thought to post a copy of my db if you'd kindly prefer to have a look, in case I am missing something important in explanation. 'Select Opp' Combobox in QuoteEntryForm is where I am trying to run the Append Query from. Thanks and your time and help is very much appreciated.



    These are the values where I have some items details stored:
    Combobox 'Select Job'- 'HouseBrandZ', 'Select Opp' - 'DoorBrandX'
    Attached Files Attached Files

  2. #17
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Thanks for posting the database - with it, I found the answer.

    For some strange reason, Query1 was not recognizing the form references as numeric data. I fixed that by forcing the expressions in the query to numeric with the Val() function:

    QID: Val([Forms]![QuoteEntryForm]![QuoteID_PK]) and Val([Forms]![QuoteEntryForm]![CmbOppList])

    Then, I made two other small changes. First, I took the after update event off [CmbOppList]. It made no sense to run the query there - what happens of you select the wrong one and have to change it? You would end up with records in the ItemsT table that shouldn't be there. Instead I put the call to Query1 in the Save Record procedure, which I changed to an Event Procedure (I hate those Embedded Macros) which looks like this:

    Code:
    Private Sub Command30_Click()
        On Error GoTo Command30_Err
        DoCmd.RunCommand acCmdSaveRecord
        DoCmd.OpenQuery "Query1", acViewNormal, acEdit
        '
        ' Requery the subform
        '
        Me!ItemsTsubform.Form.Requery
        Exit Sub
    Command30_Err:
        MsgBox "Error when saving:" & vbCrLf & Err.Description
    End Sub
    I gave a quick test and it looks like it's working. The real problem was those numerical form field references.

    Let us know how it goes!

  3. #18
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    Thank you very much for analysing this for me John_G. Your time and help is very much appreciated. Thanks very much to June7 as well for correcting my query design.

    I sensed last night that I shouldn't be using Query1 in Select Opp combobox because it appended the records when I re-selected combobox value after saving form records.

    I will be testing with your suggested changes tonight and will post the result. I am glad I decided to seek help in this forum, otherwise I was getting really demotivated with further progress of my project, after getting this far. It's my first database so every step brings new learning. Thank you again.

  4. #19
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    Glad we can help.

    every step brings new learning.
    Absolutely. And the best way to learn Access is to use it. One fun way is to set up a "sandbox" database where you can experiment and try new things without trashing your active data.

  5. #20
    sud2017 is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jul 2017
    Posts
    148
    I tested the db with your suggested changes and it's working smoothly. Thanks very much indeed for your help and thanks to the forum as well

    I am sure I will be back with more question with a different thread. Thank you again

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Access can't append all the records in the append query
    By fluffyvampirekitten in forum Access
    Replies: 2
    Last Post: 08-27-2015, 01:53 AM
  2. append to one table using multiple tables
    By tagteam in forum Access
    Replies: 2
    Last Post: 06-27-2015, 07:29 AM
  3. Append Query Saving Multiple Records
    By jewll in forum Queries
    Replies: 5
    Last Post: 12-13-2014, 03:54 AM
  4. Replies: 5
    Last Post: 12-12-2011, 08:08 AM
  5. Replies: 1
    Last Post: 10-06-2011, 08:37 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