Silvertip
Nov 3 2007, 10:28 AM
Hello,
I'm trying to get away from using email in Access for ordering materials, but I'm going to have to have 12 command buttons on a form that opens queries that may or may not have records. I've tried to find a way to figure it out by looking at condtional formatting help, but haven't come across anything like this. What I'd like to have happen is let's say all queries are empty and someone adds a record (Check Box removes them). Is there a way to make the command buttons recognize that a field in not null in a query and change the background colorof that command button to let anyone looking at the buttons know an order has come through? Someone may have an even better idea than this, but it's all I can dream up right now. Any help would be greatly appreciated!
theDBguy
Nov 3 2007, 10:42 AM
Sounds like a "cool" idea. I haven't done anything like that, but I imagine that you can use the Timer event with a DCount() function to check the table for the order and change the background color of the button accordingly. HTH.
Silvertip
Nov 5 2007, 09:24 AM
I don't think I can tie it to the table, because the records in each query are filtered from various departments and would not be organized correctly, unless I suppose I built a table for each but that would way too much work. In my codeless not too keen mind, I'm thinking that an IIF statement could open a query, view it's contents change the back color of the button if not null is present close the query and cycle around through every button while the main Form is open. Is this a crazy dream? I'm trying to play around with it, but I thought if someone out there as crazy as I am, might have already tried it and made it work.
theDBguy
Nov 5 2007, 11:07 AM
I don't think it matters if it's in a table or a query. Try this and let me know...
Set the Timer Interval of your form to 60000.
In the Timer event of the form, put this code in the form's module:
If DCount("NameOfField", "NameOfQueryForButton1") > 0 Then
Me.Button1.BackColor = vbRed
End If
HTH
Silvertip
Nov 6 2007, 01:05 PM
I tried it but it doesn't seem to be doing anything to the backcolor on the query button I put in there. I created a list box on the form that updates on MOUSE MOVE to make it functional for now. I'll keep playing with it. There are aproximately 12 command buttons on the form. If I get this to work, do I need to use this code for each button? The timer is only on the form, not the buttons.
theDBguy
Nov 7 2007, 10:48 AM
Sorry to hear that. I might have to see what you got to be able to help you further. Good luck.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.