Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Alter only one record on click event!

Status
Not open for further replies.

sodabunny

Technical User
Mar 31, 2003
17
GB
I have a form customers with a subform clients each of which has a combo box representing their status. A simple select case statement changes the backcolour when the combo box option is selected but it changes the colour of all the combo boxes on the form and not each individual record. I've been out of programming for a number of years now and I can't quite remember the code to do this. Can anybody out there help me??
 
Make sure that the code which is being used to change the colour when the combo is changed, as also applied on the OnCurrent event of the form object. This way, the combo value will be tested each time a different record is displayed (ie. becomes current), as well as when the combo for the current record is changed.

Let me know if this helps,



Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Steve,

Thanks for your help,

Unfortunately there no OnCurrent event of the form appears. I tried the Current event but it just returns an error when I open the form saying the field in question is not recognised but I know it is because it works in the combo click event. Any other suggestions would be greatly appreciated.

Sodabunny
 
Sodabunny, you may be encountering an initialisation problem. To test for this, put the following line in the current event, immediately after the
[blue]Private Sub Form_Current()[/blue] line.
[tt]
On Error Resume Next
... add the other code here
[/tt]
and see if the program works. If it does, then as I said, its an initialisation problem, and the error handler needs to be tightened up; meanwhile try this out, and keep us posted.



Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Steve101,

I'd already tried this but it gets stuck in an infinite loop. Do I need to somehow reference each record from the combo box click event maybe (I'm just guessing here)?

Sodabunny
 
Sodabunny,

I'm curious about the infinite look; it shouldnt be happening, unless you've got events (inadvertently) triggering each other. If you send me a cut down zipped up version of the application, I'll have a quick look.

Cheers,


Steve Lewy
Solutions Developer
steve@lewycomputing.com.au
(dont cut corners or you'll go round in circles)
 
Steve Lewy,

I've actually resolved this issue now by using an alternative method. I used a query to list the combo text ascending & used conditional formatting for colouring. This does mean I have to ensure the status text will begin with the right letter for it to ascend correctly but it momentarily serves it' purpose.

At some point I'd love to resolve the original problem but unfortunately due to time restrictions I'll have to follow that up later. I do appreciate the help though.

Thanks,

Sodabunny
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top