Rabu, 25 Mei 2011

[MS_AccessPros] Append query not working

 

I have a form called frmApplication which contains a field called ApplicationID. On the form frmApplication is a subform called sfrmHouseholdMembers which is a continuous form.

Also on the frmApplication is a commnd button called cmdAddApplicant

The code behind cmdAddApplication is as follows:

Private Sub cmdAddApplicantToHousehold_Click()
On Error GoTo Err_cmdAddApplicantToHousehold_Click
Dim Response As Integer

' Displays a message box with the yes and no options.
Response = MsgBox(prompt:="Add Applicant to Household?", Buttons:=vbYesNo)

' If statement to check if the yes button was selected.
If Response = vbYes Then
DoCmd.SetWarnings False
DoCmd.OpenQuery ("qryAddApplicant")
DoCmd.SetWarnings True
Me.sfrmApplicationHouseHold.Requery

Else
' The no button was selected.
Exit Sub

End If

Exit_cmdAddApplicantToHousehold_Click:
Exit Sub
Err_cmdAddApplicantToHousehold_Click:

ErrorLog "cmdAddApplicantToHousehold_Click", "frmApplication", Err, Error
Resume Exit_cmdAddApplicantToHousehold_Click
End Sub

The qryAddApplicant is defined as following:
INSERT INTO tblApplicationHousehold ( ApplicationID, FirstName, MiddleName, LastName, Suffix, MaidenName, DOB, SSN, Gender, Race, EnrolledInTribeFlag, Tribe, TribalEnrollNumber, DisabledFlag, DisabledDescription )
SELECT tblApplication.ApplicationID, tblApplicant.FirstName, tblApplicant.MiddleName, tblApplicant.LastName, tblApplicant.Suffix, tblApplicant.MaidenName, tblApplicant.DOB, tblApplicant.SSN, tblApplicant.Gender, tblApplicant.Race, tblApplicant.EnrolledInTribeFlag, tblApplicant.Tribe, tblApplicant.TribalEnrollNumber, tblApplicant.DisabledFlag, tblApplicant.DisabledDescription
FROM tblApplicant INNER JOIN (tblApplication INNER JOIN tblApplicationHousehold ON tblApplication.ApplicationID=tblApplicationHousehold.ApplicationID) ON tblApplicant.ApplicantID=tblApplication.ApplicantID
WHERE [tblApplication].[ApplicationID]=[Forms]![frmApplication]![ApplicationID];

The issue is, qryAddApplicant is not inserting anything even though there is a value in the ApplicationID field on frmApplication.

Pretty much stumped on this one. Any advise!

Thank you,

Arthur Lorenzini
Sioux Falls,SD

__._,_.___
Recent Activity:
.

__,_._,___

Tidak ada komentar:

Posting Komentar