method tried to invoke...failed

iankerry

Registered User.
Local time
Today, 06:37
Joined
Aug 10, 2005
Messages
190
Hi

I am trying to do something simple.... ha.

On a continous form i want a textbox to show me the value of the 3rd column in a combobox on the form.

so i add a text box and give it the control source =[filmCopyID].[column](2).

It works well, and i see the data i need to see.

however if i try and do anything with the form, like filter or sort, it comes up with the error

The method you tried to invoke on an object failed.

It is my new box that has causes it but dfespite googling for an hour i am none the wiser.

anyone have any ideas?

thanks

ian
 
In the OnExit event of the combo box you could put
me.text1 = me.filmCopyID.column2

that is only if the text box is name text1
 
That's probably the right idea but it should be in the combobox AfterUpdate event, not the OnExit event.
 
A contol only holds a value determined by the current record, unlike a field which has values for all records. Even in a continous form there is still only one current record despite the others being displayed so a control only has a value for one record.

Consequently filters and searches operate on the record source fields, not form controls. This is why the method is not valid for a control.

Either add the original field from the combo's row source to the record source query or modify your search to look for the field bound to the combo rather than the textbox derived from column(2). You can search for or filter on a field value even if it is not displayed in a control.
 
Thanks for your replies. As predicted the onexit or afterupdate didnt work, as Galaxiom says.

i then tried to put the field i was referring to in the text box as part of the underlying query, and this threw up a whole host of errors including 3156 timeout issues, and other bizarre ones. Too many to try and solve for such a simple issue.

I'll think again.

cheers

ian
 
i tried it another way. I copied the ComboBox (with the columns, one of which i wanted to show in a text box).

Pasted it onto the form.

I then made most of the columns 0cm length leaving it to only show the column I originally wanted. And locked it so users couldnt change the entry.

And it seems to work. On every record!

Cheers

Ian
 

Users who are viewing this thread

Back
Top Bottom