Silly problem with finding a control

daninthemix

Registered User.
Local time
Today, 08:12
Joined
Nov 25, 2005
Messages
41
Hey all,

I have this code on a number of difference forms:

[Forms]![Care Packs].Customer.SetFocus

This is executed by an event in another form that loads the new form and starts dumping in values. For some reason I'm suddenly getting "Object doesn't support this property or method. 'Object' is simply a textbox that is enabled, but is also locked altho to my knowledge this isn't a problem. It's late and I've been working for hours so this may be something simple I've overlooked...need to step away for a while.

Any thoughts?
 
try unlocking the form... dumping the text... and then relocking the form in your code.

syntax as follows:
txtbox.Locked = False

J.
 
Tried it and it won't even let me unlock it -- "object doesn't support this property or method".

Any other ideas?
 
This is executed by an event in another form that loads the new form and starts dumping in values.
I am totally confused by this. If you want to update records, use an update query or open a recordset and loop through it. Automating another form to do this is non-standard. Forms are intended to be interactive. They give a PERSON a way of displaying and modifying one record at a time.

When you do run this code, you shouldn't need to use the .setFocus method at all. Just set the value of the form field:
Forms!someform!somefield = Me.somevalue

If you are referring to the .text property of a control, change the code to remove the property reference entirely or change it to .value. The .text property is ONLY available when a control has the focus. The .value is available any time. It is also the default property which is why you can eliminate.
 
Phil - thanks very much, you've sorted it! I was confusing fields and controls. I owe you one.
 

Users who are viewing this thread

Back
Top Bottom