Results 1 to 9 of 9
  1. #1
    Join Date
    May 2006
    Posts
    386

    Unanswered: Is it possible to automatically Lock data after they are entered in a form /subform

    Dear Friends,
    I had posted this few days ago but had no response. I have been asked to create a form where one should be able to enter data most likely notes and after entering data is finished then by clicking a button which is called " Confirm" the same data with an auto date and time should appear in another column/field at the bottom of the the actual field/window where data was initially entered with the same data as above field.

    And of course once the data appears in the bottom window/subform it should automatically be locked so that no one can delete or edit that. i.e.

    Username: StartDate EndDate Details
    Phill Yong 01/01/06 15/09/06 The next statement to be raised for Abbey school should start from 16/09/06.

    I have managed to do exactly that just by creating the same fields on the same form TWICEC and I have set the "Enable" properties of the bottom field to No BUT everytime I enter a new data with new date then I would like to see the new data in the bottom field separate from the old data. Probably with a line or space and also I would like to have the auto date and time after cliking on "Confirm" button. Please note that When I click on confirm button it saves the data in the bottom field BUT when I enter new data then the old data from the bottom field disappears.

    Please open the ziped folder to see exactly what I expect the form to do.

    I would very much appreciate your kind and step by step guide on how to start.

    Any kind of assistance would be very much appreciated.
    With regards
    emi
    Attached Files Attached Files
    Emi-UK
    Love begets Love, Help Begets Help

  2. #2
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    This sounds kind of like something I did a while back for entering progress notes on home care patients, that in political correctese we also call "Clients!"

    In this example, the table has a field called ClientNotes which is Data type Memo. This will hold the notes permanently.

    On your form you need:

    1) An unbound text box named TempNotes
    2) A field named ClientNotes which is bound to the table field of the same name, and whose property Locked is set to YES
    3) A command button named Confirm


    Code:
    Private Sub Confirm_Click()
    'This line checks to assure that the TempNotes field is not empty. If it  ' is empty nothing happens (this prevents just the date from being added)
    If Not IsNull(Me.TempNotes) And Me.TempNotes <> "" Then
         
        'This checks if ClientNotes is empty and if so simply adds the 
        ' date and TempNotes to ClientNotes
        If IsNull(Me.ClientNotes) Or Me.ClientNotes = "" Then
             Me.ClientNotes = Now & ": " & Me.TempNotes
             'This line blanks out the TempNotes
             Me.TempNotes = ""
        Else  'If there's already data in ClientNotes this adds the new notes     
               ' to the old
            Me.ClientNotes = Me.ClientNotes & " " & Now & ": " &  
            Me.TempNotes
            'This line blanks out the TempNotes
             Me.TempNotes = ""
        End If
    End If
    End Sub
    So, to summarize:

    If there's no data in the temporary text box, nothing happens when Confirm is clicked.

    If there is data in the temporary textbox, clicking Confirm adds the date/time and notes to the ClientNotes.
    Hope this helps!

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

    All posts/responses based on Access 2003/2007

  3. #3
    Join Date
    May 2006
    Posts
    386
    Thank you so much for your help.
    But when I enterd the code behind the command button the below line changed to red color if i understand right, the code is missing something or is not right. Please correct me if im wrong.

    Me.ClientNotes = Me.ClientNotes & " " & Now & ": " &

    And the error message i get after clicking the Confirm button is: Compile Error
    Syntax error

    Thanks for your help.
    Last edited by Emal; 09-23-06 at 15:46.
    Emi-UK
    Love begets Love, Help Begets Help

  4. #4
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sorry, when I was copying the code before posting here the line got "wrapped."

    Code:
    Me.ClientNotes = Me.ClientNotes & " " & Now & ": " &  
            Me.TempNotes
    should be one continuous line:

    Code:
    Me.ClientNotes = Me.ClientNotes & " " & Now & ": " &  Me.TempNotes
    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 2006
    Posts
    386
    Hi Missingling, Thank you So mucchhh. Can you kindly suggest how to place relate this option to each client separately? I mean, at the moment I have a form where I have all clients details. ANd I want to use this form which you helped me to create against each client. I want to use this client notes against each clients account. e.g. I raise 100 invoices for a client starting from 01/01/06 finishing 20/02/06. So next time when i want to raise invoice statement I want to know from which date should I start? So I would need to refer to this note to see the last date I had raised the invoice statment.

    May I say THANK YOU SO MUCH AND I REALLY APPRECIATE YOUR HELP.
    Emi-UK
    Love begets Love, Help Begets Help

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    I assume the ID field is unique to each client and so each client's note will be held by your table, so that should not be a problem. I'm a little hazy as to exactly what you mean by

    I want to use this client notes against each clients account. e.g. I raise 100 invoices for a client starting from 01/01/06 finishing 20/02/06. So next time when i want to raise invoice statement I want to know from which date should I start? So I would need to refer to this note to see the last date I had raised the invoice statment.
    If you need to automatically generate invoices based on entries into you note field, this could be problematic. A memo field (which you need to hold more than 255 characters) is designed to be just that. A field to hold memos or notes. It doesn't lend itself well to data manipulation. If you need a method to track when the last invoice was generated you probably need to add a field to your table/form that you can either enter this info into or have Access enter the current date when the invoice is run off.
    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 2006
    Posts
    386
    I have successfully managed to work that around and also created a line that divides the notes everytime new data is entered. But the onlylast two things I hope I can get out of this are: that the messages should be created in decending order so that the last note appears first and that the date and time appears in Bold.

    Thanks Misslingling. you have really been helpful.
    Emi-UK
    Love begets Love, Help Begets Help

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Reversing the order the notes appear (last notes first) is no problem, replace this line:

    Code:
    Me.ClientNotes = Me.ClientNotes & " " & Now & ": " &  Me.TempNotes
    with this line:

    Code:
    Me.ClientNotes = Now & ": " & Me.TempNotes & " " & Me.ClientNotes
    Making the date/time bold, however is a no go. Access only allows formatting of an entire control. It's either all bold or not. Sorry!
    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
    May 2006
    Posts
    386
    That is perfect. THANK YOU very much for your assistance.
    Emi-UK
    Love begets Love, Help Begets Help

Posting Permissions

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