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 December 11th, 2003, 02:06 PM
Registered User
Join Date: Dec 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Subform Append Query

I have a main Form - FrmAddProject

The Form has 4 fields

JobID, JobDate, CustID, CustJobName

with a subform FrmAddProjectTapes

The sub form has 5 fields:

TapeID, ClientTapeID, JobID, AssetTypeID, TapeDesc

I want to add a button to each of the sub form tabs that exports the data:

TapeID, JobDate, OutDate (date()), DispID to a table called Tape Dispatch.

The table Tape Dispatch has the following fields:

DispID, TapeID, JobDate, OutDate

I am currently using an append query (QryDispatchByTape)for this my button code is as follows:

Public Sub DispatchQuery_Click()
DoCmd.SetWarnings False
DoCmd.OpenQuery "QryDispatchByTape"
msgbox "Done!"
DoCmd.SetWarnings True

End Sub

The query is as follows:

Expr1: [Forms]![FrmAddproject]![FrmAddProjectTapesSubform]!DGPTapeID
Expr2: [Forms]![frmaddproject]![JobDate]
OutDate: Date()

Though I get no errors, I also dont get any records added to the dispatch table

Old December 11th, 2003, 07:05 PM
Friend of Wrox
Join Date: Jun 2003
Posts: 308
Thanks: 0
Thanked 0 Times in 0 Posts

Firstly - I would take the spaces out of any object names in your database - it tends to make things a LOT harder.
Maybe try something like this (where I've used "tblDispatch" instead of "Tape Dispatch":

Public Sub DispatchQuery_Click()
Dim intTape as Integer
Dim dtJob as Date
intTape = Form_FrmAddProjectTapesSubform.DGPTapeID
dtJob = Form_frmAddProject.JobDate

CurrentDb.Execute("INSERT INTO tblDispatch ( [TapeID], [JobDate, [OutDate] )" _
    & " Values (" & intTape & ", " & dtJob & ", Date());")

MsgBox "Done"
End Sub

I am a loud man with a very large hat. This means I am in charge
(edited because of a typo)

Similar Threads
Thread Thread Starter Forum Replies Last Post
Append Query bright_mulenga Access 1 January 3rd, 2007 01:33 PM
Append Query not appending Smythe Access VBA 8 October 10th, 2006 01:16 PM
Append Query Cybersurfer Access 1 February 13th, 2006 01:02 PM
append query? bph Access 2 November 23rd, 2004 12:44 PM
append query stoneman Access 2 November 12th, 2003 09:17 PM

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