O
Opal
I posted this about a month ago and didn't get anywhere with it. I
have been struggling with different possible solutions but still
cannot get this form to work as expected.
Initially the form opened based on a sub-query which worked just
fine. However, I could
not get the records to write to a new table, I would get the above
noted error message.
Thinking that this had something to do with the limitations of opening
the form based on a
sub-query, I have changed tactics and instead have the form open bound
to a temporary table,
however, I still cannot write the records to a "permanent" table. I
still get the above
noted message.
The object of the form is for the user to view the records produced
and determine if they
should go forward or be removed - hence why I need a temporary table.
The code is as follows:
Private Sub SubmitCMRequest_Click()
If Len([EntryDatetxt] & "") = 0 Then
MsgBox "You must select a Date."
Exit Sub
End If
If [Status] = "" Then
MsgBox "You must change the status to Open."
Exit Sub
End If
If Me.Dirty Then
Me.Dirty = False
Exit Sub
End If
SubmitConcern2
End Sub
Sub SubmitConcern2()
On Error GoTo Err_Submit_Click
Dim dbobject As DAO.Database
Dim ConcernRS As DAO.Recordset
Dim strquery As String
Set dbobject = CurrentDb
strquery = "SELECT * FROM ConcernCompare;"
Set ConcernRS = dbobject.OpenRecordset(strquery)
ConcernRS.AddNew
ConcernRS!IDNumber = Forms![ConcernCompareqryfrm]!IDNumber.Value
ConcernRS!EntryDate = Forms![ConcernCompareqryfrm]!EntryDatetxt.Value
ConcernRS!Status = Forms![ConcernCompareqryfrm]!Status.Value
ConcernRS!Panel = Forms![ConcernCompareqryfrm]!AShift_Panel.Value
ConcernRS!Concern = Forms![ConcernCompareqryfrm]!AShift_Concern.Value
ConcernRS!AShift_Rank = Forms![ConcernCompareqryfrm]!AShift_Rank.Value
ConcernRS!AShift_IDNumber = Forms![ConcernCompareqryfrm]!
AShift_IDNumber.Value
ConcernRS!AShift_Comments = Forms![ConcernCompareqryfrm]!
AShift_Comments.Value
ConcernRS!BShift_Rank = Forms![ConcernCompareqryfrm]!BShift_Rank.Value
ConcernRS!BShift_IDNumber = Forms![ConcernCompareqryfrm]!
BShift_IDNumber.Value
ConcernRS!BShift_Comments = Forms![ConcernCompareqryfrm]!
BShift_Comments.Value
ConcernRS.Update
Exit_Submit_Click:
Exit Sub
Err_Submit_Click:
MsgBox Err.Description
'Resume Exit_Submit_Click
End Sub
Any assistance would be appreciated. Thank you.
have been struggling with different possible solutions but still
cannot get this form to work as expected.
Initially the form opened based on a sub-query which worked just
fine. However, I could
not get the records to write to a new table, I would get the above
noted error message.
Thinking that this had something to do with the limitations of opening
the form based on a
sub-query, I have changed tactics and instead have the form open bound
to a temporary table,
however, I still cannot write the records to a "permanent" table. I
still get the above
noted message.
The object of the form is for the user to view the records produced
and determine if they
should go forward or be removed - hence why I need a temporary table.
The code is as follows:
Private Sub SubmitCMRequest_Click()
If Len([EntryDatetxt] & "") = 0 Then
MsgBox "You must select a Date."
Exit Sub
End If
If [Status] = "" Then
MsgBox "You must change the status to Open."
Exit Sub
End If
If Me.Dirty Then
Me.Dirty = False
Exit Sub
End If
SubmitConcern2
End Sub
Sub SubmitConcern2()
On Error GoTo Err_Submit_Click
Dim dbobject As DAO.Database
Dim ConcernRS As DAO.Recordset
Dim strquery As String
Set dbobject = CurrentDb
strquery = "SELECT * FROM ConcernCompare;"
Set ConcernRS = dbobject.OpenRecordset(strquery)
ConcernRS.AddNew
ConcernRS!IDNumber = Forms![ConcernCompareqryfrm]!IDNumber.Value
ConcernRS!EntryDate = Forms![ConcernCompareqryfrm]!EntryDatetxt.Value
ConcernRS!Status = Forms![ConcernCompareqryfrm]!Status.Value
ConcernRS!Panel = Forms![ConcernCompareqryfrm]!AShift_Panel.Value
ConcernRS!Concern = Forms![ConcernCompareqryfrm]!AShift_Concern.Value
ConcernRS!AShift_Rank = Forms![ConcernCompareqryfrm]!AShift_Rank.Value
ConcernRS!AShift_IDNumber = Forms![ConcernCompareqryfrm]!
AShift_IDNumber.Value
ConcernRS!AShift_Comments = Forms![ConcernCompareqryfrm]!
AShift_Comments.Value
ConcernRS!BShift_Rank = Forms![ConcernCompareqryfrm]!BShift_Rank.Value
ConcernRS!BShift_IDNumber = Forms![ConcernCompareqryfrm]!
BShift_IDNumber.Value
ConcernRS!BShift_Comments = Forms![ConcernCompareqryfrm]!
BShift_Comments.Value
ConcernRS.Update
Exit_Submit_Click:
Exit Sub
Err_Submit_Click:
MsgBox Err.Description
'Resume Exit_Submit_Click
End Sub
Any assistance would be appreciated. Thank you.