TheStriker
Registered User.
- Local time
- Today, 21:36
- Joined
- Jan 5, 2004
- Messages
- 17
Hello,
I have a problem adding a record using my current method. I have a main form with a subform. The subform consist of a listbox(single selection) and its coresponding text boxes. When the user selects a record from the listbox, its text fields reflect the record selected. I've accomplished this using this method because I think this is the only way to get the listbox and its fields on the subform to update when the user selects a record from the listbox:
Forms![New]![Comments_WSReplacement subform]![nSiteID].Value = Me.WSRList.Column(0)
Forms![New]![Comments_WSReplacement subform]![sComment].Value = Me.WSRList.Column(10)
Forms![New]![Comments_WSReplacement subform]![nContactTypeID].Value = Me.WSRList.Column(4)
Forms![New]![Comments_WSReplacement subform]![nActionTypeID].Value = Me.WSRList.Column(8)
Forms![New]![Comments_WSReplacement subform]![nIssueTypeID].Value = Me.WSRList.Column(6)
Forms![New]![Comments_WSReplacement subform]![dtCreatedON].Value = Me.WSRList.Column(1)
This works fine but when I try to add a record using the DoCmd.GoToRecord,,acNewRec, it actually edits the record selected in the listbox. When I click to add a new record here are the arguments:
DoCmd.GoToRecord , , acNewRec
Me.nSiteID.Value = Forms!New!nSiteID
Me.nUserID.Value = Forms!New!UserID
Me.dtCreatedON.Value = Now()
Is there a more reliable way to do this? Thanks in advance.
I have a problem adding a record using my current method. I have a main form with a subform. The subform consist of a listbox(single selection) and its coresponding text boxes. When the user selects a record from the listbox, its text fields reflect the record selected. I've accomplished this using this method because I think this is the only way to get the listbox and its fields on the subform to update when the user selects a record from the listbox:
Forms![New]![Comments_WSReplacement subform]![nSiteID].Value = Me.WSRList.Column(0)
Forms![New]![Comments_WSReplacement subform]![sComment].Value = Me.WSRList.Column(10)
Forms![New]![Comments_WSReplacement subform]![nContactTypeID].Value = Me.WSRList.Column(4)
Forms![New]![Comments_WSReplacement subform]![nActionTypeID].Value = Me.WSRList.Column(8)
Forms![New]![Comments_WSReplacement subform]![nIssueTypeID].Value = Me.WSRList.Column(6)
Forms![New]![Comments_WSReplacement subform]![dtCreatedON].Value = Me.WSRList.Column(1)
This works fine but when I try to add a record using the DoCmd.GoToRecord,,acNewRec, it actually edits the record selected in the listbox. When I click to add a new record here are the arguments:
DoCmd.GoToRecord , , acNewRec
Me.nSiteID.Value = Forms!New!nSiteID
Me.nUserID.Value = Forms!New!UserID
Me.dtCreatedON.Value = Now()
Is there a more reliable way to do this? Thanks in advance.