Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397

    Question Unanswered: Select / Where Code Error

    Hi,

    I have a subform with main form. I deleted record source of subform and put below code line in forms OnLoad event. It displays all records in subform at opening / loading

    RecSQL = "SELECT T_NFS.[No], T_NFS.MName, T_NFS.[Date_of_Birth], T_NFS.City, T_NFS.Mstate FROM T_NFS"

    I placed a combo box onto main from based on a table that have 12 records as month. (Just numbers as 1, 2,3,......12)

    I need subform to requery and present new records based upon selection of the month from the combo box. Hence I wront similiar select statement code line but with creiteria in AfterUpdate event of combo.

    But code produces error on "M"

    RecSQL = "SELECT T_NFS.[No], T_NFS.MName, T_NFS.[Date_of_Birth], T_NFS.City, T_NFS.Mstate FROM T_NFS WHERE (DatePart("M",[Date_of_ Birth])=combo14;"

    How can I get the all the people whose birth month is that I selected in the combo box ?

    With kind regards,
    Ashfaque

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Hi

    One problem is two opening parentheses and one closing. I personally just stick with:

    Month(MyDate)

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    another problem is you are not picking up the value of the combo:
    Code:
    WHERE MONTH([Date_of_ Birth])= " & Me.Parent.ComboName.Value
    Testimonial:
    pootle flump
    ur codings are working excelent.

  4. #4
    Join Date
    Jan 2005
    Location
    Nanded, India
    Posts
    397
    Oh..thank u very much...

    It works fine now.....

    With kind regards,
    Ashfaque

Posting Permissions

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