Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 2nd, 2007, 03:34 AM
Authorized User
 
Join Date: Nov 2005
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
Default Append Query

I have an append query in my payroll system I Have created in Access. I have 18 records in my payroll and every month it must append 18 records. The problem is after the second month when I wanted to append 18 records for the third month, it is instead appending 36 records. Meaning all the records for the first and second month. What criteria should I use in under the Date field. This is what I have in the append from expr1:date() in the append to field I have DATE,then criteria Date(). What should I do in the date criteria so that the query only appends the last 18 records every time. Please Help

Bmulenga
__________________
Bmulenga
 
Old January 3rd, 2007, 01:33 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

It sounds to me like you want to be able to append only those records from a specific month.

To do that, create a field in your query called "AppendMonth" and put this expression on the Field line:

AppendMonth:(DatePart("m", [DateField]))

This will show you a single number that is the month the record is for.

Then pass this parameter to the append query button. Either use a combo box on the form, and type in 1, 2, 3, 4, 5, etc. and have the user select the month number. In the criteria line for the AppendMonth field in your query, put this:

[Forms]![frmMyAppendForm].[cboAppendCombo]

Or do this to pass it from the combo box:

Dim iMonth As Integer
Dim sLink As String

iMonth = Me.cboAppendCombo

sLink = "[AppendMonth] = " & iMonth

DoCmd.OpenQuery "qryAppendMonthQueryName",,, sLink

Put sLink in the WHERE clause section of the line. I can't remember where that is.

Did that help?



mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
Append Query Cybersurfer Access 1 February 13th, 2006 01:02 PM
Append Query Quandry SerranoG Access 5 November 15th, 2005 06:36 PM
append query? bph Access 2 November 23rd, 2004 12:44 PM
append query stoneman Access 2 November 12th, 2003 09:17 PM
Append query problem vladimir Access VBA 4 July 23rd, 2003 07:58 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.