Results 1 to 3 of 3
  1. #1
    DSTR3 is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    NYC-North Jersey
    Posts
    22

    SQL Rowsource

    I have a listbox that gets its rowsource from a query. I want to eliminate the query and and just use SQL how would I write this?
    This is the way it is now...

    With Me.ListDay
    .RowSource = "SELECT Days.DayID, Days.DayName, QMenDaySort.SchedStartDay " & _
    "FROM Days LEFT JOIN QMenDaySort ON Days.DayID = QMenDaySort.SchedStartDay " & _
    "WHERE (((QMenDaySort.SchedStartDay) Is Null)) " & _
    "ORDER BY Days.DayID;"
    .ColumnCount = 3
    .ColumnWidths = "0 in;2 in;0 in"
    .Requery
    End With

    Here is the SQL statement of that same Query....



    SELECT tblMenuSchedule.SchedStartDay, tblMenuSchedule.SchedMenuID, tblMenuSchedule.SchedTerminalID
    FROM tblMenuSchedule
    WHERE (((tblMenuSchedule.SchedMenuID)=[Forms]![frmMenuCreator]![TxtMenuID]) AND ((tblMenuSchedule.SchedTerminalID)=[Forms]![frmMenuCreatorPasteDayMenu]![TxtID]));

    Thanks
    DS

  2. #2
    weekend00 is offline I may not be right
    Windows XP Access 2003
    Join Date
    Aug 2010
    Posts
    1,295
    With Me.ListDay
    .RowSource = "SELECT tblMenuSchedule.SchedStartDay, tblMenuSchedule.SchedMenuID, tblMenuSchedule.SchedTerminalID " & _
    "FROM tblMenuSchedule WHERE (((tblMenuSchedule.SchedMenuID)='" & [Forms]![frmMenuCreator]![TxtMenuID] & "') AND " & _
    "((tblMenuSchedule.SchedTerminalID)='" & [Forms]![frmMenuCreatorPasteDayMenu]![TxtID] & "' ))"
    .ColumnCount = 3
    .ColumnWidths = "0 in;2 in;0 in"
    .Requery
    End With

  3. #3
    DSTR3 is offline Novice
    Windows XP Access 2010 (version 14.0)
    Join Date
    Nov 2010
    Location
    NYC-North Jersey
    Posts
    22
    Thank you. This seems simple enough!
    DS

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 1
    Last Post: 11-01-2010, 06:59 PM
  2. Replies: 0
    Last Post: 08-26-2009, 11:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums