Thank you for the response. Now the situation is degrading. I am
seeing very odd behaivor. Before I move to the "edit" form, save the
changes, return to the main form, move next then move prev (or move
prev then move next) and see the changes. Now from time to time I
have to move next 2 times then back 2 times (or vice versa) to see the
updates/inserts. Here is the code (note that in my original post I
didn't have the actual form names in front of me. Form names are NOT
the problem)....
'**********************************************************
From the main form:
'**********************************************************
Private Sub loadSetStatusForm()
DoCmd.OpenForm "frmEditDODetail", acNormal, , , , acDialog
End Sub
'+++++++++++++++++++++++++++++++++++
' In the edit form.
'+++++++++++++++++++++++++++++++++++
Private Sub cmdInsert_Click()
Dim lngStatusID As Long
Dim strNotes As String
Dim dteDate As Date
Dim objCon As ADODB.Connection
Dim objCmd As ADODB.Command
Dim objPrm As ADODB.Parameter
Set objCon = New ADODB.Connection
Set objCmd = New ADODB.Command
Set objPrm = New ADODB.Parameter
If IsNull(cboStatus.Value) Then
MsgBox "Please Select a Status Message", vbOKOnly, "Error"
Me.cboStatus.SetFocus
Else
lngStatusID = Me.cboStatus.Value
dteDate = CDate(Format(Now(), "dd mmm yyyy"))
If Not IsNull(txtNotes.Value) Then
strNotes = Me.txtNotes.Value
Else
strNotes = ""
End If
objCon.Open (CurrentProject.Connection)
'Setup Command Object for DB Call
With objCmd
.CommandText = "sp_insert_do_status"
.CommandType = adCmdStoredProc
.ActiveConnection = objCon
Set objPrm = .CreateParameter("do_id", adInteger,
adParamInput, , g_lngDOID)
.Parameters.Append objPrm
Set objPrm = .CreateParameter("s_id", adInteger,
adParamInput, , lngStatusID)
.Parameters.Append objPrm
Set objPrm = .CreateParameter("dte", adDate,
adParamInput, , dteDate)
.Parameters.Append objPrm
Set objPrm = .CreateParameter("StatusNotes", adVarChar,
adParamInput, 255, strNotes)
.Parameters.Append objPrm
.Execute 'works fine. I see the changes in the table after
the insert
End With
objCon.Close
Set objCon = Nothing
Set objCmd = Nothing
Set objPrm = Nothing
Forms!frmDOMain!sfrmDOStatus.Form.Requery ' This doesn't work
DoCmd.Close acForm, "frmEditDODetail"
End If
End Sub
Unless someone tells me other wise, although this is a logical flow of
events (open main form - find record, flow to a form to edit the
record, return to main form & changes should be visible) it appears
that either way off base on how to make the changes visible or that MS
Access "doesn't work that way".
I have spent hours on this ridiculous problem.
rm said:
I have a main form (frmDO) with a subForm (frmDODetail) where the sub
control name is sfrmDODetail. The subform is a datasheet.
When I double click on sfrmDODetail and edit form is displayed
(frmEditDODetail).
When I save the changes in the edit form (frmEditDODetail) I want the
sub form (sfrmDODetail - frmDODetail) to display the edits/changes/
additions made by the user.
I have tried numerous different ways (many suggested in this group) to
make the sub form (sfrmDODetail - frmDODetail) requery. I have tried
Forms! etc, Dim frm as FORM_frmDODetail. I have spent 4 - 5 hours
trying every different combination. At one point I had a variation of
Forms! working. Then out of the blue the method no longer worked.
I am in the military - in Iraq. Three days ago I was laying in a 1
foot deep ditch with mortar rounds landing within a quarter mile of my
position. I am far more upset, frustrated about working with this
Microsoft Product!
I guess difficult/frustration are relative to how familiar
we are with a situation. Most people would not think that
laying in a ditch was a preferred response ;-)
I think your issue is that the Requery must wait until the
edits in frmEditDODetail have been completed. This can be
done from frmEditDODetail's Close event ptocedure using:
Forms!frmDO.sfrmDODetail.Form.Requery
A differnt approach is structurally cleaner because users
can not jump around your other forms (creating a confusing
scenario) and because frmEditDODetail has no need to "know"
which form opened it. This is accomplished by opening
frmEditDODetail in Dialog mode immediately followed by the
requery:
DoCmd.OpenForm "frmEditDODetail", WindowMode:=acDialog
Me.Requery
--
Marsh
MVP [MS Access]- Hide quoted text -
- Show quoted text -