Results 1 to 9 of 9

Thread: Text message

  1. #1
    Join Date
    May 2014
    Posts
    8

    Post Unanswered: Text message

    Hi
    Wondering if I could have some advice.

    I have a date picker and I wish to add text in a text box under a specific date and show up every time I select that date.

    Your help is much appreciated

  2. #2
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    495
    Provided Answers: 24
    If you mean a box appears after a date is entered...
    in the txtDate_afterupdate event:
    txtBox.visible = txtdate = "9/1/2014"

  3. #3
    Join Date
    May 2014
    Posts
    8

    Text box

    Hi Ranman256

    Thanks for your reply.
    Sorry I wasn’t clearer with my problem.

    Basically I have a date picker, and I want to be able to display a comment under a specific date ie “You cannot choose this date”
    Either in a text box or an error message?

    Thanks in advance

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Replacing txtDateField with the actual name of the Textbox that holds the selected date

    Code:
    Private Sub txtDateField_BeforeUpdate(Cancel As Integer)
     If Me.txtDateField = #8/5/2014# Then
      MsgBox "You Cannot Choose This Date!"
      Cancel = True
     End If
    End Sub

    If the specific date is selected the user will not be able to leave the Control until an allowed date is selected.

    Linq ;0)>
    Last edited by Missinglinq; 08-05-14 at 20:51.
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  5. #5
    Join Date
    May 2014
    Posts
    8

    Error message

    Thanks Missinglinq that’s really useful

    I need the user to be able to insert forbidden dates and show up as that error, without having to change the code.
    Can that be done?

    I.e. user can insert a date as a forbidden date so other users know that, the date is not to be used "You Cannot Choose This Date!"


    Many thanks again

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sure, but it would save everyone time if you give a full explanation of your needs with your original post.

    You'll need a small utility Table to hold your 'forbidden dates' as well as a small Form for entering the dates. Then something like this:
    Code:
    Private Sub txtDateField_BeforeUpdate(Cancel As Integer)
     If DCount("*", "tblForbiddenDates", "[DateField] = # " & Me.txtDateField & "#") > 0 Then
      MsgBox "This Date Cannot Be Selected!"
      Cancel = True
     End If
    End Sub

    where
    1. DateField is the actual name of the Field in the utility Table
    2. tblForbiddenDates is the actual name of the utility Table
    3. txtDateField is the actual name of the Textbox on the original Form (the Form where the checking is being done)

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Join Date
    May 2014
    Posts
    8

    Text help

    Thank you Missinglinq

    You are absolutely right , I didn't explain what I needed and I apologise for that.
    To tell you the truth I had an idea of what I wanted but just couldn't get it across.

    Thanks very much for your help and time I really appreciate it

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    You're quite welcome...it's just that everyone here are volunteers and their time, like everyone else's, is valuable! The older I get, the more I realize this!

    As far as being able to 'get it across,' vis-à-vis what you need actually need, this is one of the most important aspects of programming! Especially being able to get it across to yourself! This part of program development should occur before you ever sit down to the computer and open up Access or any other programming app! I've been doing program development since the pre-Windows days (my first PC then had a 20 mb hard drive, and was 'state-of-the-art') and still always start a project with a pen and legal pad! Planning is everything and doing it properly can save you literally hundreds or thousands of hours of development time, down the road!

    Good luck with your project!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  9. #9
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    FYI, ranman, the delimiter for explicit Date/Time Fields is the Octothorp or 'pound sign,' so your example of

    Quote Originally Posted by ranman256 View Post

    txtBox.visible = txtdate = "9/1/2014"
    should have been

    txtBox.visible = Me.txtdate = #9/1/2014#

    Just thought you should know.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •