There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
 
Business Applications
Tag Cloud
audio blue blue screen boot bsod compaq computer cpu crash dell drivers dvd error excel firefox format freeze freezing hard drive hardware install internet internet explorer kb951748 lan laptop loss of internet malware memory motherboard network networking outlook outlook 2007 problem restart screen security slow sound trojan update virus vista windows windows xp winxp wireless zonealarm zone alarm
Search
Search in:
 
Advanced Search
Tech Support Guy Forums > Software & Hardware > Business Applications >
Appearing text boxes and Date diff


Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members. Enjoy!

Closed Thread
 
Thread Tools
rev_ollie's Avatar
Computer Specs
Junior Member with 10 posts.
 
Join Date: Aug 2008
Location: UK lincolnshire
Experience: Intermediate
28-Sep-2008, 07:10 AM #1
Question Appearing text boxes and Date diff
Hi everyone

Im trying to learn a load of stuff in access to get some practice in for when i find my project out next year and decided to make a hotel system.

Im looking at the moment at a few barriers i hope you can help me with

Firstly i have a text box called txt (origional or what :P) and a check box called check.
Im sure this has been asked before but i cant get it to work. I would like the check box to make the text box appear when ticked so when there is no value eg no tick in check then txt is invisible.
At the moment i have this:

Private Sub check_Click()
If check.Value = 1 Then
txt.Visible = True
Else
txt.Visible = False
End If
End Sub

It makes the text box dissapear but when i go to click it again it does nothing. I though i could add another IF statment to then say if there was

check.Value = 0
txt.Visible=False

But id doesnt work so can you help me on this one.

Also whats the best validation method to use to stop people booking the day before. Eg the date now is the 28 Sept 08 how can i stop someone booking a room for the 27 sept 08? Will i just use a date diff function to stop it. the field for that is just called date.

Thanks any help would be great
MRdNk's Avatar
Computer Specs
Senior Member with 284 posts.
 
Join Date: Apr 2007
Experience: Pretty Darn Good at Excel
28-Sep-2008, 07:29 AM #2
Hi rev_ollie
Firstly welcome to the forums.

Next, the solutions.

Problem 1:
Use True and False, for your checkbox value:
Code:
Private Sub check_Click()
    If check.Value = True Then
        txt.Visible = True
    Else
        txt.Visible = False
    End If
End Sub

Problem 2:
txt.Value < Date -- "<" is less than; and "Date" is today's date.
Code:
Private Sub txt_LostFocus()
    If txt.Value < Date Then
        txt.BackColor = 255 'Red
    Else
        txt.BackColor = 16777215 'Standard colour
    End If
End Sub
This uses lostfocus, ie. after a user has updated this txtbox, and tabbed out of it, then run event procedure.
I've also made it change the background colour of the txtbox to red if its before today, but you can replace this with whatever you like.date.
__________________
MRdNk
-----------
Pretty darn good at Excel VBA .
Learning: Access (OOP), Javascript, and PHP.


Harry Hill's Retort to a Heckler:
'You may say that now, but I'm safe in the knowledge that when I go home, I have a warm chicken in the oven.' - Harry Hill
rev_ollie's Avatar
Computer Specs
Junior Member with 10 posts.
 
Join Date: Aug 2008
Location: UK lincolnshire
Experience: Intermediate
28-Sep-2008, 08:02 AM #3
Hi MRdnk

Thanks so much for the solution to part one. It work great exactly what i want it to do. Brilliant

As for the second part it looks right but just to be sure where is the best place ot put it. Should i just do it under code of should i add it as an event procedure?

Thanks again
MRdNk's Avatar
Computer Specs
Senior Member with 284 posts.
 
Join Date: Apr 2007
Experience: Pretty Darn Good at Excel
28-Sep-2008, 08:17 AM #4
Add it as an event procedure, I have one little revision and that would be use it under the "After Update", instead of "Lost Focus"
rev_ollie's Avatar
Computer Specs
Junior Member with 10 posts.
 
Join Date: Aug 2008
Location: UK lincolnshire
Experience: Intermediate
05-Oct-2008, 08:32 AM #5
Hi again
Ive now moved on with the booking system the last on anyway and ive found out there was an incorrect realtionship in the system so ive started again.
Ive been looking into a different way of booking but i cant seem to get it to work.
The idea is the query will look for the appropriate fields and then thats linked to the form to book but:
1 there is a problem with query_previouse_booking something about and aggregate function

2 now if that was to work how could i get the overall thing to book?. im guessing it would be some form of code or control linked to a button that would save the file in a table ready to book?

any help would be great .

PS i have attached it to the post to have a look at its zipped because it wont allow access files. I will change the format from 2003 if required
Attached Files
File Type: zip Hotel booking system V1.zip (115.8 KB, 0 views)
Closed Thread

Tags
date diff, dissapear, text box, true false, visible

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.



Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 03:21 PM.
Copyright © 1996 - 2008 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Powered by Cermak Technologies, Inc.