My query keeps overwriting my datatable

I created an access dbase that store business opportunities. I created a form the allows the editing and entering of new opps by our sales force. The form in itself reads a table that the data fills into but the controls from the form come from other tables. I changed all of the boxes to combo boxes to basically force the sales force to enter only data that is useful and acceptable to my group which prices these opportunities and there is where the problem started. In the form I have three combo boxes Primary Target, Category, and Distributor discount. When these three combo boxes are filled out and the sales rep presses the button I embedded into the form a pop up form with a combo box which contains the available products based upon the criteria provided. The pop up form is based on a query. When they select a product from the menu and hit the select button on the pop up form the following code runs

Option Compare Database

Private Sub Command2_Click()
DoCmd.RunCommand acCmdCopy
DoCmd.OpenForm "Funnel", acNormal, "", "", , acNormal
DoCmd.RunCommand acCmdPaste
DoCmd.Close acForm, "frmcrdqry"

End Sub

Which is supposed to copy the value the rep picked and paste it into the product field on the master form. The problem is when I select a product and run the module it not only copies the value like it is supposed to but it is overwriting the source table that contains the list of products which it should not. Can anyone point me to what I am doing wrong is it my code ?

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!