Results 1 to 4 of 4
  1. #1
    Join Date
    Apr 2011
    Posts
    30

    Unanswered: problem with afterupdate event

    Here is my code below. Everytime [combodates] updates I get the infamous "Enter Parameter Value: Me.Combodates". can anyone please help?

    Private Sub Combodates_AfterUpdate()
    If Me.grpClasses = 1 Then
    Me.Listregistered.RowSource = "SELECT contacttable.id, contacttable.lastname, contacttable.firstname FROM contacttable WHERE contacttable.photo1register = Me.Combodates"
    End If
    End Sub

    I was given the suggestion that my original code was passing in a string literal when you wanted to pass the value inside Combodates instead. You have to terminate the string before access will figure out that you didn't literally want the words "me.combodates"


    Private Sub Combodates_AfterUpdate()
    If Me.grpClasses = 1 Then
    Me.Listregistered.RowSource = "SELECT contacttable.id, contacttable.lastname, contacttable.firstname FROM contacttable WHERE contacttable.photo1register = " & Me.Combodates
    End If
    End Sub


    But, with this second set of code, when I test the control it is unresponsive. Before when the parameter window popped up I could at least manually type the date in and the listbox would populate. Should there be another set of quotes or something of that sort in this code? Thanks btw.

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    If photo1register is NOT of type numeric you must to include single quotes (Text) or format it properly (Date/Time).
    For Text type:
    Code:
    WHERE contacttable.photo1register = '" & Me.Combodates & "'"
    For Date/Time type:
    Code:
    WHERE contacttable.photo1register = #" & Format(Me.Combodates, "mm/dd/yyyy") & "#"
    Have a nice day!

  3. #3
    Join Date
    Apr 2011
    Posts
    30

    you just made me the happiest person in the world

    Thanks for that. It works perfect.

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    You're welcome!
    Have a nice day!

Posting Permissions

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