Some sort of button?

Mark-BES

Registered User.
Local time
Today, 14:23
Joined
Nov 23, 2004
Messages
85
Hi all,

I have a very simple form that details loan machines for customers.

What I need is a very obvious sign on each record to see if the machine is in our stock or not.

A normal check box is an ovious answer but they are too small and my users complain (bigger glasses were an option :) ).

Ideally a toggle button or something that the user can click and it will change colour maybe between Green and Red (Please see attached screen shot) Green for in stock and red for out on loan. Any ideas or suggestions would be fantastic.
 

Attachments

  • scr shot.JPG
    scr shot.JPG
    36.3 KB · Views: 172
Hi, thanks for the quick reply.

Not sure if it is required as there will only be approx 20 records.
 
I strongly advise you make a stock checking query, get back to me if you need help doing this, also if you post a zipped up version of yur database it will be faster.
Chris
 
Thanks for you help.

Like this? (see attached(sorry still using A97)).
 

Attachments

Sorry, Here it is in Access 97, use the navigation buttons to go through the records.
Chris
 

Attachments

That is excellent! I will incorporate that into my other Spares Stock controls Db.

With regard to the one originally posted. I wonder if you would take a very quick look at this attachment.

The form has a module (a free download from http://www.peterssoftware.com/index.htm ). This solution would be ideal for my users if I could in some way bind it to the record so either red or green would be displayed to specific record. It relies only on a simple click.

Once again thanks for your help. I have a VBA book on order and can't wait to start learning this stuff! :)
 

Attachments

Well, You could spend weeks trying to understand all that code or you could do it my way. All you need is 2 image files in either bmp or jpeg, a bit of code and a query. Its better to first learn all the basics of VBA before trying to use Functions/Modules and Windows API's. Yes it is possible to do what you want with the database you have attached, i can do it for you but ideally you should do it yourself from the example i sent you, ask for help if you get stuck.
Chris
 
Last edited:
Your right.

Looking in detail, the way you have done it looks a lot better in the long run. I think I was getting in a little over my head eh?

Your code:

Private Sub Form_Current()
If stt.Value = "0" Then
Command8.ForeColor = vbRed
Command8.Caption = "Out Of Stock"
Else
Command8.ForeColor = vbGreen
Command8.Caption = "In Stock"
End If
End Sub

I kind of understand how this works. What kind of string would I substitute here…

Command8.ForeColor = vbGreen
Command8.Caption = "In Stock"

…if I only wanted the button to display on screen when value = 0

Anyway Chris you have been most helpful. I really appreciate you people helping us beginners out.
 
Private Sub Form_Current()
If stt.Value = "0" Then
Command8.Visible = True
Command8.ForeColor = vbRed
Command8.Caption = "Out Of Stock"
Else
Command8.Visible = False
Command8.ForeColor = vbGreen
Command8.Caption = "In Stock"
End If
End Sub

There you go, don't mention it, i am just gald i could help you solve your problem, if you want i ll make the button appear green or red as per your requirement as well?
thanks
Chris
 
Your a star and a gentleman!

I think you have done more than enough for me today. Pat yourself on the back and get down the pub!

Thanks once again! :)
 
Although,

Would this work? (Value="null") if I wanted the button to react to a empty field?

Private Sub Form_Current()
If stt.Value = "null" Then
Command8.ForeColor = vbRed
Command8.Caption = "Out Of Stock"
Else
Command8.ForeColor = vbGreen
Command8.Caption = "In Stock"
End If
End Sub
 
No it wouldn't because if you look at the table the default value is set to 0 and the way the query is setup. I gotta go now, its time to go home. Have a nice weekend.
Chris
 

Users who are viewing this thread

Back
Top Bottom