on click help

gmc2k2

Registered User.
Local time
Today, 00:41
Joined
Oct 7, 2008
Messages
21
Hi, i have code which is attached to onclick of a checkbox,

what i want it to do is if the user clicks it and checks it then to add some note to a memo field, if the user clicks it and its already checked then it doesn't add a note to a memo field.
Code:
Private Sub Check45_Click()
If Check45 = 0 Then
Check45 = 1
If Len([Forms]![Customer]!Notes.Value & "") = 0 Then
    Forms![Customer]!Notes.Value = VBA.DateTime.Date & " " & VBA.DateTime.Time & " - " & _
    "letter Sent"
  Else
    Forms![Customer]![Notes] = Forms![Customer]!Notes.Value & _
               vbNewLine & _
               VBA.DateTime.Date & " " & VBA.DateTime.Time & " - " & _
               "letter Sent"
End If
End Sub

but i can't seem to add any other lines which make sense to me that it doesnt add "letter sent" to a memo field if its already checked?

any help would be appreciated
 
No Code, No Access Keyword, in simple words, explain what you want to do. The above is confusing me !
 
Hi paul again :) The code should be attached?

there's a checkbox (check45) i know i will rename instantly :) it was just a temp code

with the code above it should run on click of the check box and what i want it to do is if its clicked and checked it then runs this code:
Code:
If Len([Forms]![Customer]!Notes.Value & "") = 0 Then
    Forms![Customer]!Notes.Value = VBA.DateTime.Date & " " & VBA.DateTime.Time & " - " & _
    "letter sent"
  Else
    Forms![Customer]![Notes] = Forms![Customer]!Notes.Value & _
               vbNewLine & _
               VBA.DateTime.Date & " " & VBA.DateTime.Time & " - " & _
               "letter sent"

but the problem being everytime it's clicked (even though its already checked) it adds another line "letter sent" rather than stoping the code because its checked. so im trying to get it to stop if its clicked but already checked?

if that makes sense?
 
You have one small bad habit, LOL. You reply without making sure what you give is what other actually ask you to give. I said No CODE, in simple plain words. But you give me code again ! LOL
Code:
[COLOR=Green][B]'PSEUDOCODE[/B][/COLOR]
Private Sub yourCheckBoxName[COLOR=Red][B]_AfterUpdate[/B][/COLOR]()
    If Not Me.yourCheckBoxName Then
        [COLOR=Green]'This will be executed if the CheckBox has NOT been ticked
        'Here you can add code to add notes or whatever ![/COLOR]
    End If
End Sub
Check the event, I have moved it from Click to AfterUpdate, the click event might be a bit early to identify the value.
 
I didn't realise it was a lot easier than i tried to explain :( i was up all night and havent had much sleep, sorry for the confusion. Thank you so much again Paul absolute legend.
 
No problem, sometimes in life, things you look for are lot more easier to find; if we just stop for a minute and "see" ! Good Luck fella ! :)
 

Users who are viewing this thread

Back
Top Bottom