P
PeterM
I have a form in AC2003 which has a listbox on it (List238) containing all
records for the table. My user can click on a listbox entry and I query that
record. Well, when my users change a field and click the save button it
executes the following code.
Private Sub BTN_Save_Click()
On Error GoTo Err_BTN_Save_Click
Dim strMsg As String
strMsg = strMsg & "Save Changes?" & Chr(13) & Chr(13)
If MsgBox(strMsg, vbQuestion + vbYesNo, "Please Confirm!") = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.List238.Requery
Me.Refresh
Else
DoCmd.RunCommand acCmdUndo
End If
Exit_BTN_Save_Click:
Exit Sub
Err_BTN_Save_Click:
MsgBox Err.Description
Resume Exit_BTN_Save_Click
End Sub
Here is the recordsource for the listbox
SELECT Diabetes_Diary.DD_Date AS [Date], Format([dd_date],"ddd") AS [Day],
Diabetes_Diary.DD_Average AS [Avg], Diabetes_Diary.DD_Comments AS Comments
FROM Diabetes_Diary
ORDER BY Diabetes_Diary.DD_Date DESC;
The field I'm having a problem with is Diabetes_Diary.DD_Average. It's not
calculated via the query, it's a stored field (I know that's not the way to
do it but I inherited this mess). When the user clicks the Save command
button the record is updated and the List238.Requery fires but the listbox
does not change. If the user closes the form and reopen it, the correct
value is displayed in List238.
This one is driving me nuts (granted, a short trip) but I'm at the end of my
rope. Can anyone see what I'm doing wrong?
Thanks for the help!
records for the table. My user can click on a listbox entry and I query that
record. Well, when my users change a field and click the save button it
executes the following code.
Private Sub BTN_Save_Click()
On Error GoTo Err_BTN_Save_Click
Dim strMsg As String
strMsg = strMsg & "Save Changes?" & Chr(13) & Chr(13)
If MsgBox(strMsg, vbQuestion + vbYesNo, "Please Confirm!") = vbYes Then
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Me.List238.Requery
Me.Refresh
Else
DoCmd.RunCommand acCmdUndo
End If
Exit_BTN_Save_Click:
Exit Sub
Err_BTN_Save_Click:
MsgBox Err.Description
Resume Exit_BTN_Save_Click
End Sub
Here is the recordsource for the listbox
SELECT Diabetes_Diary.DD_Date AS [Date], Format([dd_date],"ddd") AS [Day],
Diabetes_Diary.DD_Average AS [Avg], Diabetes_Diary.DD_Comments AS Comments
FROM Diabetes_Diary
ORDER BY Diabetes_Diary.DD_Date DESC;
The field I'm having a problem with is Diabetes_Diary.DD_Average. It's not
calculated via the query, it's a stored field (I know that's not the way to
do it but I inherited this mess). When the user clicks the Save command
button the record is updated and the List238.Requery fires but the listbox
does not change. If the user closes the form and reopen it, the correct
value is displayed in List238.
This one is driving me nuts (granted, a short trip) but I'm at the end of my
rope. Can anyone see what I'm doing wrong?
Thanks for the help!