Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2004
    Posts
    22

    Question Unanswered: Change the view statements of a Combobox, with SQL

    Hi There,

    I have a little problem here, I have a combo that gets the date from a table with this format dd/mm/yyyy -> i.e. 01/03/1997, and that I want to do is to show only the month and year (for example, March/1997), could somebody know how can I do?.

    The SQL code that I use to populate the combobox is:

    Code:
    Select DISTINCT tblTarifas.fecha FROM tblTarifas ORDER BY tblTarifas.fecha
    thnks a lot for ur comments
    __________________
    David García Sánchez
    Student B.Sc. Physics Engineering.
    Monterrey Tech, MEXICO

  2. #2
    Join Date
    Aug 2004
    Location
    Cary, NC
    Posts
    264
    Code:
     
     
    Select DISTINCT format(tblTarifas.fecha,"MMMM/YYYY") as theDate
    FROM tblTarifas ORDER BY tblTarifas.fecha
    or something similar to that. The important part is the format(string,"MMMM/YYYY") part.

    Steve

  3. #3
    Join Date
    Aug 2004
    Posts
    22

    Unhappy It sends me an error msg :(

    I try your suggestion but it show me an error msg:

    The statement ORDER BY (tblTarifas.fecha) is in conflict with DISTINCT

    I told you that I have more than 1 date for an specific date (i.e.I have six may first etc...), and I want to show only one.

    the SQL statement that I prove is this:

    Code:
    Select DISTINCT tblTarifas.[Format(tblTarifas].[fecha,"mmmm/yyyy")] As theDate
    FROM tblTarifas
    ORDER BY tblTarifas.[Format(tblTarifas].[fecha,"mmmm/yyyy")], tblTarifas.fecha;
    thanks for ur comments

  4. #4
    Join Date
    Aug 2004
    Location
    Cary, NC
    Posts
    264
    Sorry about that, didn't read carefully enough. You should be ok as follows

    Code:
    Select DISTINCT Format([tblTarifas].[fecha],"mmmm/yyyy") As theDate
    FROM tblTarifas
    ORDER BY Format([tblTarifas].[fecha],"mmmm/yyyy")
    be careful how you put the [ ] around the field and table names.

    Hope that works.
    good luck!

    Steve

Posting Permissions

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