Page 1 of 2 12 LastLast
Results 1 to 15 of 21
  1. #1
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20

    Problem entering result of (Append) query into field in table

    Hi, I'm trying to get a field in a table to automatically fill with the result of an Append query but it is not working. The query is run on an Appointments table to get the date of the Clients first appointment and I was hoping to store this date in the Counselling table but It's not working. I also have to figure out how to enter the date of the last appointment if the CounsellingFinished Yes/No field is selected. If anyone has any idea how to do this and could show me where I'm going wrong, that would be great. Here's what I've done so far

    Click image for larger version. 

Name:	appendQryFirstAppointment.jpg 
Views:	8 
Size:	224.1 KB 
ID:	15988

    and the resulting table has not been updated

    Click image for larger version. 

Name:	TblCounselling.jpg 
Views:	8 
Size:	174.5 KB 
ID:	15989

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    What happens when you run the Append query, nothing?

    What data type is the field "CounselingID" in tblCounseling?

  3. #3
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20
    You're right, nothing happens. The CounsellingID is an autonumber (PK), does this make a difference as it's only the DateOfFirstSession and DateCounsellingFinished I wish the queries to update

  4. #4
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Autonumber fields are, generally, not included in an append query. The fact that you are not getting any warnings after you try to run the Append query indicates additional issues. I would try removing the Append function from the query until after you view the correct information as a SELECT query and or Totals query.

    You will need to address the issue involving the Autonumber field. I suspect Non-Normalized data structure is an underlying factor. Consider the relationships between your query and the table you are appending.

  5. #5
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20
    It works as a select query but I don't get what you mean by "Non-Normalized data structure is an underlying factor".
    This is the relationships between the main tables which I think is pretty normalised, maybe I'm wrong.

    Click image for larger version. 

Name:	Counsellingrelationship.jpg 
Views:	7 
Size:	123.3 KB 
ID:	15991

  6. #6
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    What I did not notice at the beginning is that the table you are appending to is part of your Append query. It seems that what you want to do is UPDATE existing records, not Append new records to a table.

    If you want to append records, remove the CounsellingID field from your Append query.

  7. #7
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20
    Thanks for getting back so quicky, I'm burning the midnight oil here and my brain is going to sleep. You're right, I just want to update records that already exist, both queries work so I should use an update query, I only noticed it now you've mentioned it, I researched online and got reference to append query. Should I remove the counsellingID from the update query as I thought it would be used to get the correct records to update

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    You stated that you want to UPDATE existing records in tblCounseling. An Append query will not do this. You could use an UPDATE query, where the Key value "CounsellingID" from tblCounseling equals the key value in tblCounseling.

    Another approach is to use a SELECT query as the Recordsource of a form and edit the current record of the form's Recordset.

  9. #9
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20
    I don't know which would be best, I'm trying to make this as easy to use as possible as the lady I'm helping out would be quite clueless when it comes to using a database. I need both of these pieces of information for reports she would be doing quarterly and annually. which would you recommend under these circumstances

  10. #10
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    The typical approach is to use a form's recordset to edit existing records. If you are changing the status of several records, you can automate this with code using an action query like UPDATE or using DAO.

  11. #11
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20
    I've no knowledge of VBA, would it be something like when a client on the waiting list is allocated to a counsellor, the appointment form is opened and an appointment date is selected, this appointment date is then used to update DateOfFirstSession i.e. when Save button is clicked it also runs the update query

  12. #12
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    If it is just the CURRENT record you are updating/editing, have the user type the value into a bound control. If there are several records to update, you will want an event to fire some VBA. The code can call on an object like an action query or the code can manage the entire process. Automation will require some code. You may be able to incorporate a Macro. You will still need to pass criteria to the UPDATE query from the form. I find Macros can, at times, be as complex as writing basic VBA.

  13. #13
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20
    I wondering if I need to record the first/last appointment, maybe I should just use the dates on the query for the report. VBA and Macros would be beyond my ability

  14. #14
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Calculated data is not usually stored in tables. As you see, Access is about managing the data you store in your tables. You already have the appointment date in your table and there is not a need to enter a calculated version of this date. Calculated data changes over time. Use queries and VBA to retrieve data when you need it.

  15. #15
    theresa's Avatar
    theresa is offline Novice
    Windows 8 Access 2007
    Join Date
    Feb 2014
    Location
    Ireland
    Posts
    20
    Thanks, that's what I was thinking, I could call current clients based on the dates of their appointments if they fall within the date parameters on the form and finished clients if the yes/no box is selected in the tblCounselling and the last appointment date is within the date parameters on the form. I'll delete the fields DateOfFirstSession and DateCounsellinEnded in tblCounselling. Do you think this would work?

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

Similar Threads

  1. Replies: 2
    Last Post: 11-27-2013, 05:24 PM
  2. Replies: 15
    Last Post: 07-20-2013, 12:42 PM
  3. Problem with append query for attachment field
    By ahmadrezaahmad in forum Queries
    Replies: 9
    Last Post: 06-29-2013, 09:08 PM
  4. Linked Table Append Query Problem.
    By dlab85 in forum Queries
    Replies: 4
    Last Post: 03-13-2013, 07:30 AM
  5. Replies: 2
    Last Post: 02-28-2013, 07:00 PM

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