Hi,
I'm having problems getting a form to show records that I've just added through ADO.
The following code is in a module. What I'm doing is creating a new transmittal record (like a delivery note) and a drawing record. The code to add the records works perfectly - they are there when I look in the tables but when I open the form it doesn't have the new records.
Please respond with any ideas - I've spent ages trying to get this to work or find some way around it.
I'm having problems getting a form to show records that I've just added through ADO.
The following code is in a module. What I'm doing is creating a new transmittal record (like a delivery note) and a drawing record. The code to add the records works perfectly - they are there when I look in the tables but when I open the form it doesn't have the new records.
Please respond with any ideas - I've spent ages trying to get this to work or find some way around it.
Code:
With transmittalsRecords
If IsNull(openTransmittal) = True Then
[COLOR="YellowGreen"] 'create new transmittal note (one side of relationship)[/COLOR]
.AddNew
!DocTypeA = ColA
!DocTypeB = ColB
!DocTypeC = ColC
!DocTypeSeq = ColSeq
!TransmittalDate = Date
!CCNum = ControlCopy
newTransID = !DocID
.Update
End If
[COLOR="yellowgreen"] 'add new drawing (one side of relationship)[/COLOR]
.AddNew
!outTransmittalID = newTransID
!DrawingNum = DrawingNum
!RevisionNum = Rev
!ActionCode = previousActionCode
!quantity = 1
.Update
.MoveNext
End With
Debug.Print "newTransID: " & newTransID
[COLOR="yellowgreen"]'my attempts to get it to requery..[/COLOR]
[COLOR="Red"]Forms!frmOutTransmittals.Form.RecordSource = "qselOutTransmittal"
Forms!frmOutTransmittals.Form.Requery
Forms!frmOutTransmittals.Form.Refresh
'open form to show transmittal just added
DoCmd.OpenForm "frmOutTransmittals", acNormal, , "[DocID]=" & newTransID & ""[/COLOR]
End If