combobox lookup works but can't add new record

  • Thread starter David_Beginner via AccessMonster.com
  • Start date
D

David_Beginner via AccessMonster.com

Main form has a combo box with client list. Upon selecting client the
subform loads a datasheet with the client's orders. this is accomplished
using the common script:

Private Sub combo5_afterupdate()
' Find the record that matches the control.
Dim rs As Object
Set rs = Me.Recordset.Clone
rs.FindFirst "[clients]![ClientID] = " & Str(Nz(Me![Combo5], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

This works great except that after including this code I am not able to
create a new record.
Or in other words a new order id will not be created in the orders table.

When I take the code out and make Orders.OrderID the control source I am able
to add a new record, the autonumber orderid is automatically created.
However, the combobox can no longer pull up the associated order after update.
And the records have to be navigat throught the nav buttons.

I am assuming that something in the code needs to be altered or added, but
have not been able to figure out.

Below is the basic setup:
TblClients
TblOrders
TblOrderDetails
TblProducts

Main Form:
Query Clients.ClientID(PK AN), Orders.OrderID(PK AN)

ComboBox Unbound
After_update from code above

Sub Form:
Query OrderDetails.OrderID, ProductID / Products.Product/ID

Linked on Orders.OrderID and OrderDetails.OrderID

Thanks,

david
 
A

Asad Ali

Hi to all Group Member

yesterday I was searching from google som vedios
I hve just found a lagrest and greatest group of
online vedios on internet

which Is on daily bases
it updates vedios on daily bases
so must check it to keep intouch with the world to examine what is happing
in side our world

the link is
http://obm.itnews.googlepages.com

regards and thnanks

Asad ali
manager :E-Idea google Group
cell:+923217507176
Email:[email protected]
web:http://obm.itnews.googlepages.com
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top