I have a classic form Products (frmProducts) with lookup ADO control Datacombo at field SupplierID, table Suppliers (adoPrimaryRS -> Products, adoSekRS -> Suppliers). This working OK.
Applied cmdRefreshDataCombo command button which added new item in dcbSupl (DataCombo). Click at command button call frmSuppliers in that is added new record (item). With Save or Cnacel command button close frmSuppliers and back in frmProducts.
Problems is because what adoSekRS.Requery not working in batch procedure (cmdAddSupl_Click) – not look new item. But, when is clicked simply at RefreshDataCombo_Click - refresh DataCombo is OK.
Dim WithEvents adoPrimaryRS As Recordset
Dim WithEvents adoSekRS As Recordset
Public Sub cmdAddSupl_Click()
Load frmSuppliers ' Add new record u LookUp form (recordset)
frmSuppliers.mbLookUp = True
frmSuppliers.Show vbModal
Set frmSuppliers = Nothing
RefreshDataCombo_Click ' Refresh Datacombo control with new item (record)
End Sub
Private Sub RefreshDataCombo_Click()
If Not (bkmAddBookmark = 0) Then ' Execute if NOT press cmdCancel in frmSuppliers
adoSekRS.Requery ‘ Problems- not working in: Sub cmdAddSupl_Click() !!!
dcbSupl.Refresh
End If
dcbSupl.SetFocus
End Sub
Please help me.
Respectfully,
Dušan Grujiæ
e-mail:
ozisabac@ptt.yu