Form Problems

DJ100

Registered User.
Local time
Today, 20:47
Joined
Jul 4, 2002
Messages
34
Hi

I am having problems . .

I have a form which is basically an order form. It contains Customer Deatails, order details etc.

One of the features of the form is a Combo box used to select a particular vehicle - this works fine - using a Select query for its data.

Anyway, I have added a new field to the Table & Query - it is a simple yes/no field. I would like to display this as a check box on my main form with the result dependant upon what value is in the database.

I want to do this so I can use conditional formating on the combo box - ie. If me.checkbox = Yes Then
me.combobox.forecolour = 255


Anyway, my problem is that I can't display this check box value or get my code to recognise it . . .

Help would be gratefully received

Cheers

David J
 
The reference for a check box isn't yes or no but either true and false or -1 or 0

Check the att for any help

Dave
 

Attachments

Thanks both . . .

With regards to formatting if I put a check box on the form with the following code in the After Update I can change the text colour

Sub Check_Price()
If Me.CheckPrice = True Then
Me.Vehicle.ForeColor = Red 'Change text to red
Else: Me.Vehicle.ForeColor = Black 'Change text to black
End If
End Sub

So, what I want to do is update the check box with the value in the vehicle table / select vehicle query and then do it, the only way I can think of doing it is to update the check box in the after update of the combo box then also run the above code.

My problem then is still the same, how do I update that check box with a value from a table??

Hmmmmmmmm
 
As oldsoftboss was saying, the checkbox can only store a value of true/false. In order to accurately conditionally format the combo, you need to store this true/false value in the vehicle table . Then as a vehicle is picked / checkbox changed / record changed, it will change the colour of the combo.

As I demonstrated in an earlier post on the same topic, you will now need to call the colour changing code from 3 places, combo afterupdate, checkbox afterupdate and form_Current depending on which event is fired. To make it easier, put the colour changing code into Form_Current ie

If Me.CheckPrice = True Then
Me.Vehicle.ForeColor = Red 'Change text to red
Else: Me.Vehicle.ForeColor = Black 'Change text to black
End If

then on the afterupdate of combo and checkbox

Form_Current

Does this clarify it a bit? - Did you try the demo I posted also?
 
Yeah,

That's exactly what I've done - the field is in the table - (as a check box) my problem is that I can't get the field to display on the form and update dependant upon which vehicle is chosen . . .

The combo box gets it's data from Select Query (to which I have also added the CheckPrice check box . . .

No matter how I try to accomplish this I struggle - I am a real access novice - have been programming VBA for Excel for years but am just getting the hang of access

I have looked at the samples attached to earlier posts which have proved really useful.

Many thanks
 
Post it to me if you like. I'll pm my e-mail address to you and I'll have a shifty.
 

Users who are viewing this thread

Back
Top Bottom