|
| |
|
|
ladysnake38
Posts: 1 Joined: 12/21/2007 Status: offline
|
Updating on form field to another form field - 12/21/2007 12:57:58
Hi All: I'm having a problem updated on field in one form with the contents of a field in another form. In the Main Form (frmntwnar), I have a field called CurrNotes and a Button (Add New Status). When the button is pushed it opens up the second form (Frmhiststat - which they do not want as a subform). There are three fields within the second form. ID (corresponding to the ID in main form - which is autonumbered), LastDateUp - double-clicking in this field adds the current date, and HSCurrNotes where the newest update is added. There is a close button which when its pushed, I want the code to save the entry in the second form's table (tblhiststat - which it does), clear the CurrNotes field in the main form (which it does) and copy the newest entry from the second form's HSCurrNotes into the main form field CurrNotes (which it doesn't). This is currently the code I have now: Private Sub Close_Histstat_Form_Click() On Error GoTo Err_Close_Histstat_Form_Click 'Before the close, take the most current record and place it into the NAR form 'under Last Status Dim OldStatus As String Dim NARCurrNotes As String Form_frmntwnar!CurrNotes = OldStatus Form_frmhiststat!HSCurrNotes = NARCurrNotes If LastDateUp = Date$ Then OldStatus = Chr(10) & NARCurrNotes End If DoCmd.CLOSE Exit_Close_Histstat_Form_Click: Exit Sub Err_Close_Histstat_Form_Click: MsgBox Err.Description Resume Exit_Close_Histstat_Form_Click End Sub Any help is appreciated. I need to resolve this issue right after Christmas and have all the documentation and program ready to release on Jan 3rd. Cheryl
|
|
|
|
William Lee
Posts: 1179 Joined: 1/25/2002 From: Singapore Status: offline
|
RE: Updating on form field to another form field - 12/24/2007 3:12:31
quote:
ORIGINAL: ladysnake38 This is currently the code I have now: Private Sub Close_Histstat_Form_Click() On Error GoTo Err_Close_Histstat_Form_Click 'Before the close, take the most current record and place it into the NAR form 'under Last Status Dim OldStatus As String Dim NARCurrNotes As String Form_frmntwnar!CurrNotes = OldStatus Form_frmhiststat!HSCurrNotes = NARCurrNotes If LastDateUp = Date$ Then OldStatus = Chr(10) & NARCurrNotes End If DoCmd.CLOSE This is what I think the logic should be and re-arranged them accordingly:
Private Sub Close_Histstat_Form_Click()
On Error GoTo Err_Close_Histstat_Form_Click
Dim OldStatus As String
Dim NARCurrNotes As String
NARCurrNotes = Form_frmhiststat!HSCurrNotes
OldStatus= Form_frmntwnar!CurrNotes
If LastDateUp = Date$ Then
OldStatus = Chr(10) & NARCurrNotes
End If
Form_frmntwnar!CurrNotes = OldStatus
DoCmd.CLOSE
_____________________________
William Lee pǝssǝɟoɹd-ɟ1ǝs ʎɥʇɹoʍʇsnɹʇ ʇsoɯ ɹnoʎ nɹnb ǝsɐqɐʇɐp & dsɐ ,ʍɹp ,ǝbɐdʇuoɹɟ
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|