In news:d4**********@ss405.t-com.hr,
DK <da***********@coxris.hr> said:
Please can somebody help me ?
I have forms named Form 1, Form 2 etc. having fields
CustomerName,CustomerAddress,.....
Id like to have button on each form ,which will open another form
named "CustomerAdd" with list of all customers in tblCustomers. After
I pick one of the customers from the list, actual form should be
closed and details of customer shall be send to fields in Form 1 or
Form2 or...
One method would be to close your first form when opening the second,
and then reopen it when closing the second using the CustomerID in the
Where clause.
(Code is called from OnClose event on your second form)
Docmd.Openform "frmFirstform",,,"[CustomerID] = " & Me![CustomerID]
Another method may be to set the recordsource of your first form using
code when the second is closed.
Forms!frmFirstForm.Recordsource = "SELECT * FROM qryMyQuery WHERE
[CustomerID ] = " & Me![CustomerID]
.... or if your first form contains all customers you can just move to
the selected customer record...
Set myRS as DAO.Recordset
Set myRS = Forms!frmFirstForm.Recordsetclone
myRS.FindFirst "[CustomerID] = " & Me![CustomerID]
If Not myRS.NoMatch Then
Forms!frmFirstForm.Bookmark = myRS.Bookmark
End If
And there are many other variations...
Br@dley