move row from one table to another

ok, What I was trying to get at is that you don't want to be filtering on the value of the name - what if two employees have the same name? You should be filtering on the key value. So in a normal combo box, the first column would hold the employee's primary key, and the second column would hold the name. When an item was selected, you would take the primary key value and use that to filter on. So I was asking about your SQL to try to find out the name of the field that is the primary key for the employee. I am not seeing it in what you posted, but in any case your where clause should be WHERE [NAME OF PRIMARY KEY FIELD] = Forms!YourForm!YourComboBox.
 
Ah, yeah i did think of that but i thought i would fix that later, but since you have pointed it out i will change it. The cableInstaller is the field i want filtered depending on the name. The cableinstaller field is inputed from another form and the data comes from a seperate employee table. So if i input the employess ID number instead of there name then it will eliminate the dual name problem, that also means that the filter will need to operate with the id number.

I will change it and report back :)

Thanks
Dom
 
Alisa, I have changed it to the ID of the employees rather than there actual names to avoid the error of two names being the same but..as before, instead of the name(ID) being selected from the combo box it is popping up a msg box and asking the ID to be typed in. It works when i type in the ID number of the employees but i would prefer the employees ID number to be selected from the combo box.

I have no idea why its doing this.:confused:


Thanks
Dom
 
How are you giving the ID from the combo box to the query? If it is asking you for the ID, that means it thinks you are using a parameter query, i.e., it doesn't understand the input.
 
To input the ID number from the combo box i just go to the query and into design view, i then click on the CableInstaller Criteria box and right click it and click Build, i then select Combo22 from the form list. Which comes out as:
Forms![ViewCableCardForm]![Combo29]

the way i see it, if i select whatever name in the combo box this number should be put into this Criteria box of the Field CableInstaller, this will then only display records that have the same CableInstaller ID as the Criteria box.
If i just type in an ID number into the Criteria box it works but then the query only displays one specific Record(or more if they have CableInstaller ID the same as the Criteria ID number).
 
Is the form open and the combo box filled when you are running the query?
 
Is the form open and the combo box filled when you are running the query?
I have tried it both ways(open and closed) but i doesnt make a difference, it still asks for
[Forms]![EmployeeForm]![Combo22].[Column(0)])
to be entered.
 
Open the query, then right click and go to parameters. Is anything in there? The reason I ask is because the parameter it is asking for is different than the way you said you were giving it the key id from the combo box. If there is anything under parameters, just delete it.
 
Open the query, then right click and go to parameters. Is anything in there? The reason I ask is because the parameter it is asking for is different than the way you said you were giving it the key id from the combo box. If there is anything under parameters, just delete it.

There are no parameters.
Yeah i dont know why it is asking for it via a message box instead of taking the value from the combo box. The actual combo box has no influence on the query, it doesnt matter what i put in the combo box. the message box that pops up is what decide's what records are filtered. I put a preview button on the form so that once i select the ID in the combo box i can preview the query but, when i open the form it asks for
[Forms]![EmployeeForm]![Combo22].[Column(0)])
then it doesnt matter what i choose in the combo box as when i click on the preview button it asks for
[Forms]![EmployeeForm]![Combo22].[Column(0)])
again.

Thanks Again
Dom
 
Ok, open the form, pick something from the combo box. Then go to your immediate window and type ? [Forms]![EmployeeForm]![Combo22].[Column(0)]) and then enter
Does it give you the right value?
 
I didnt know what the immediate window was but i do now after a google;)

I entered
?[Forms]![ViewCableCardForm]![Combo29].[column(0)]
into the window and pressed enter, it gave this error:

runtime error 438
object doesnt support this property or method.

I tried:
?[Forms]![ViewCableCardForm]![Combo29]
and it returned number 9, because i had selected 9 in the combo box.
 
Last edited:
OK, so you need tp put [Forms]![ViewCableCardForm]![Combo29] as the criteria in your query, since that is what returns the right value. Make sure the form is open when you run the query . . . does it work?
 
I then tried replacing the value in the CableInstaller Criteria box with just the
?[Forms]![ViewCableCardForm]![Combo29]

but now when i click on the form it doesnt show anything, its totaly grey.
 
Last edited:
OK, open the form, pick something from the combo box. Does that much work?
 
Yes but i have to remove the

[Forms]![ViewCableCardForm]![Combo29]

from the criteria box to allow me to see anything in the Form.
Once that is removed the combo box works fine.
 
Ok, with something selected in the combo box, open the query separately, and then type in Forms!ViewCableCardForm!Combo29 as the criteria, then run the query, does that work?
 
yes it works :D

but now, on the form, i cant select the Preview button to display the filtered query.

I can change the combo box number and then run the query and it filters everything apart from what i have in the combo box, exactly what i wanted, but i cant preview the query from the button on my form.
 
What preview button? Is that a command button you put on the form or something else?
 

Users who are viewing this thread

Back
Top Bottom