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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

If text box matches value in List box then...........

Status
Not open for further replies.

Taff82

Programmer
Feb 11, 2004
43
GB
Hi all,

Not sure how to word this, but please bare with me.

I have a form with several unbound text boxes which make up a Calender. When the form Loads Values are passed to these text boxes which make up the dates of the month.

What i would like to happen is if one of the Values of my unbound text box matches one of them in my table, then make the backcolor of the text box that matches the Value Red.

Am really unsure how to do it.

Thought might have to use a list box or a run a query maybe?

My unbound text boxes are called Date1, Date2, Date3 and so on. When the form loads the Values will be for example:-

01/04/2004, 02/04/2004 and so on.

Any help will be greatly appreciated.

Regards


Taff
 
Hi

You do not explain how the value in the table is referenced from the form, is it bound to the form perhaps, but anyway, assuming the value from the tabel is somehow placed in a textbox named txtTheDate

Then

Dim ctl as Control
for each ctl in me.Controls
if Left(ctl.name,4) = "Date" Then
If ctl.value = txtTheDate Then
ctl.ForeColor = vbRed
End if
End If
Next ctl

should do it, note above not tested, just straight out of my head

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Thanks for replying Ken,

Am unsure where to put that code. I downloaded the database and can't remember from where, so there is a lot of code I dont understand and I have just changed it so it works to my liking. My VB and SQL knowledge is very limited!!!

Is there anyway I can upload it for you to look at and maybe it will make more sense to you than it does to me.

Regards

Taff
 
Hi Ken,

440kb compressed but not Zipped.

92kb Zipped.

Regards

Taff
 
Hi

OK, no promises but you can send the zipped version to my EMail address kenneth.reayATtalk21.com wheer AT is @.

Please state the version of Access

Note I will not be able to look at it until 19:00 UK time (its 11:00Uk now) because I am currently on a client site which has restrictions on downloading zips or anything containing VBA.

Regards

Ken

Regards

Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
Website needs upgrading, but for now - UK
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top