Wrox Programmer Forums
|
Access VBA Discuss using VBA for Access programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access VBA 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 December 7th, 2005, 01:06 PM
Registered User
 
Join Date: Dec 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default too few parameters expected 1

can anyone help with this when the user enters the start date and finish date all records
that are in table work and that match the dates in field adate should be selected.
but I get the error too few parameters expected 1

thanks jim

Dim strSql As String
Dim strMsg As String
  Set ws = DBEngine(0)
  ws.BeginTrans
bInTrans = True
  Set db = ws(0)

  'Step 2: Execute the append.
  strSql = "INSERT INTO work1 ( ID, CONTRACT, JOBNo , TARGET, ADATE, TOTAL, LEADER)" & _
    "IN ""f:\database\FABRICATION WORK.mdb"" " & _
    "SELECT ID, CONTRACT, JOBNo , TARGET, ADATE, TOTAL, LEADER FROM WORK WHERE ADATE between #" & [Forms]![Archive]![STARTDATE] & "# and #" & [Forms]![Archive]![finishdate] & "# ;"

 
Old December 7th, 2005, 03:41 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 3,069
Thanks: 0
Thanked 10 Times in 10 Posts
Default

I don't understand, you want to take records from one table between two dates and append them to another table?

I would have the user select the dates on your form, then in the query criteria put this line:

BETWEEN Forms!Archive.StartDate AND Forms!Archive.FinishDate

Then just do a DoCmd.OpenReport, or DoCmd.RunQuery (which would run your Append Query above and pull the dates off your form without passing them in code. No need for all this code.

HTH

mmcdonal





Similar Threads
Thread Thread Starter Forum Replies Last Post
update stt- Too few parameters. Expected 1. s_sanks Classic ASP Databases 0 March 7th, 2008 08:03 AM
Too few parameters. 1 expected !!! chacquard Access VBA 2 June 21st, 2005 08:00 AM
too few parameters expected n desprate Access VBA 6 April 29th, 2005 06:33 AM
Error "Too Few Parameters - Expected 1" timmaher Access VBA 2 August 31st, 2004 04:04 AM
Too few parameters. Expected 1. harry_barry Classic ASP Databases 2 May 26th, 2004 04:12 PM





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