G
Gina Whipp
Hey All,
I have Me.Refresh in two places, the first example works but second does not
and unless I rem it out the code won't compile. Can someone tell me why?
Thanks,
Gina Whipp
1st Example: This works...
If IsNull(Me.txtNonConformanceID) Then
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID SET
tblGetAUPReferenceID.garAUPReferenceID = [garAUPReferenceID]+1 WHERE
(((tblGetAUPReferenceID.garCustomerID) =
[Forms]![sfrLiftNonConformance]![txtCustomerID]));"
DoCmd.RunSQL "INSERT INTO tblNonConformance ( ncAUPReferenceID )
SELECT tblGetAUPReferenceID.garAUPReferenceID FROM tblGetAUPReferenceID
INNER JOIN qryLiftNonConformance ON tblGetAUPReferenceID.garCustomerID =
qryLiftNonConformance.crCustomerID WHERE
(((qryLiftNonConformance.lID)=[Forms]![sfrLiftNonConformance]![txtID]));"
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID INNER JOIN
qryLiftNonConformance ON tblGetAUPReferenceID.garCustomerID =
qryLiftNonConformance.crCustomerID SET
qryLiftNonConformance.lNonConformanceID =
[tblGetAUPReferenceID]![garAUPReferenceID] WHERE
(((qryLiftNonConformance.lID)=[Forms]![sfrLiftNonConformance]![txtID]));"
Me.Refresh
DoCmd.SetWarnings True
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
Else
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
End If
2nd Example: This doesn't work...
If IsNull(Me.txtNonConformanceID) Then
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID SET
tblGetAUPReferenceID.garAUPReferenceID = [garAUPReferenceID]+1 WHERE
(((tblGetAUPReferenceID.garCustomerID) =
[Forms]![frmCoilReceipt]![cboCustomerID]));"
DoCmd.RunSQL "INSERT INTO tblNonConformance (
ncAUPReferenceID )SELECT tblGetAUPReferenceID.garAUPReferenceID FROM
tblGetAUPReferenceID INNER JOIN tblCoilReceiving ON
tblGetAUPReferenceID.garCustomerID = tblCoilReceiving.crCustomerID WHERE
(((tblCoilReceiving.crCoilID) = [Forms]![frmCoilReceipt]![cboCoilID]));"
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID INNER JOIN
tblCoilReceiving ON tblGetAUPReferenceID.garCustomerID =
tblCoilReceiving.crCustomerID SET tblCoilReceiving.crNonConformanceID =
[tblGetAUPReferenceID]![garAUPReferenceID] WHERE
(((tblCoilReceiving.crCoilID) = [Forms]![frmCoilReceipt]![cboCoilID]));"
<<<<<<Me.Refresh NOT WORKING>>>>>>
DoCmd.SetWarnings True
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
Me.cmdUndoNC.Enabled = True
Else
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
End If
I have Me.Refresh in two places, the first example works but second does not
and unless I rem it out the code won't compile. Can someone tell me why?
Thanks,
Gina Whipp
1st Example: This works...
If IsNull(Me.txtNonConformanceID) Then
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID SET
tblGetAUPReferenceID.garAUPReferenceID = [garAUPReferenceID]+1 WHERE
(((tblGetAUPReferenceID.garCustomerID) =
[Forms]![sfrLiftNonConformance]![txtCustomerID]));"
DoCmd.RunSQL "INSERT INTO tblNonConformance ( ncAUPReferenceID )
SELECT tblGetAUPReferenceID.garAUPReferenceID FROM tblGetAUPReferenceID
INNER JOIN qryLiftNonConformance ON tblGetAUPReferenceID.garCustomerID =
qryLiftNonConformance.crCustomerID WHERE
(((qryLiftNonConformance.lID)=[Forms]![sfrLiftNonConformance]![txtID]));"
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID INNER JOIN
qryLiftNonConformance ON tblGetAUPReferenceID.garCustomerID =
qryLiftNonConformance.crCustomerID SET
qryLiftNonConformance.lNonConformanceID =
[tblGetAUPReferenceID]![garAUPReferenceID] WHERE
(((qryLiftNonConformance.lID)=[Forms]![sfrLiftNonConformance]![txtID]));"
Me.Refresh
DoCmd.SetWarnings True
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
Else
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
End If
2nd Example: This doesn't work...
If IsNull(Me.txtNonConformanceID) Then
DoCmd.SetWarnings False
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID SET
tblGetAUPReferenceID.garAUPReferenceID = [garAUPReferenceID]+1 WHERE
(((tblGetAUPReferenceID.garCustomerID) =
[Forms]![frmCoilReceipt]![cboCustomerID]));"
DoCmd.RunSQL "INSERT INTO tblNonConformance (
ncAUPReferenceID )SELECT tblGetAUPReferenceID.garAUPReferenceID FROM
tblGetAUPReferenceID INNER JOIN tblCoilReceiving ON
tblGetAUPReferenceID.garCustomerID = tblCoilReceiving.crCustomerID WHERE
(((tblCoilReceiving.crCoilID) = [Forms]![frmCoilReceipt]![cboCoilID]));"
DoCmd.RunSQL "UPDATE tblGetAUPReferenceID INNER JOIN
tblCoilReceiving ON tblGetAUPReferenceID.garCustomerID =
tblCoilReceiving.crCustomerID SET tblCoilReceiving.crNonConformanceID =
[tblGetAUPReferenceID]![garAUPReferenceID] WHERE
(((tblCoilReceiving.crCoilID) = [Forms]![frmCoilReceipt]![cboCoilID]));"
<<<<<<Me.Refresh NOT WORKING>>>>>>
DoCmd.SetWarnings True
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
Me.cmdUndoNC.Enabled = True
Else
DoCmd.OpenForm "frmNonConformance", , , "[ncAUPReferenceID]=" &
Me![txtNonConformanceID]
End If