Adding into a parameter query in main form

  • Thread starter Thread starter Sansanee
  • Start date Start date
S

Sansanee

Hi all,

I am trying to allow user to add data into a parameter query that takes
clientID and queries all the record in sub form. I allow add and enter data
but still from the Vb code it gave me the error that I can't add to the sub
form table because there is no corresponding record for ClientID.

Can anyone help me with this problem?

Sunny
 
Your parameter query is in the wrong place! Put the parameter query in the
main form. The user will enetr the ClientID, the main form will go to that
client, the subform will go to the records for that client and the user can
then enter new data into the subform.

BTW, having the user enter a clientID is a poor way to go to a desired
record. First of all, how is the user suppose to know the clientID of the
client he wants. Second, you are letting the user input any value for
ClientID whether it is in the database or not. The correct way is to use a
combobox or listbox that has the value of clientID but displays the names
the clients in the database.
 
I was usinga drop-down box that user just look into the clientID and that is
in the mainform. But my question is whteher it is possible to let user add
records in the subform because I tried to do so and get the error.
 
Yes your user can enter data into the subform. As long as you have your
subform linked to your main form by ClientID then when a user enters into
the subform, the ClientID will automatically be entered into the
subform's datasource. However, many of my past students have made the
mistake of building their subforms using a 'query' instead of just
linking the subform to the actual datasource. This will prevent 'data
entry'. Many people think the subform should use a query to 'lookup' the
value from the main form. The linking method I used will do the
'relational' lookup for you.

Sure hope this helps you out...

Timothy Anderson
Millennium III Mgt Consulting
www.m-iii.org
 
Back
Top