By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,561 Members | 3,083 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,561 IT Pros & Developers. It's quick & easy.

list box search and results display on list box

P: 25
I would like to make a query from
transactions to see the patron history by enter a barcode.
I have made a recordset to get the patron barcode
in the same time to get the Id field from patrons
as this value is connected to the [checked out to] field in the transaction.


I have tried
Expand|Select|Wrap|Line Numbers
  1.          str = "SELECT [ID], [BookID], [Checked in date], [Checked Out Date], [DueDate] FROM Transactions ORDER BY [duedate] Where [checked out to] = " & _
  2.             rspatrons![ID]
  3.  
  4.  
  5.             Me.result_list.AddItem "ID; Title; Checked in date; checked out date ; due date "
  6.             Me.result_list.RowSource = str
my result_list is a value list type
and it displays
ID book id checked in date checked outdate due date

in the first line without my search results.

did i miss anything ?
thanks.
Jan 7 '12 #1

✓ answered by issactang

i tried to do this

Expand|Select|Wrap|Line Numbers
  1.  str = "select  [books].[id],[books].[title],[transactions].[checked in date],[transactions].[checked out date],[transactions].[due date]" & _
  2. "from transactions " & _
  3. "where [transactions].[checked out to] = " & _
  4. rspatrons![ID] & _
  5. "inner join books " & _
  6. " ON [transaction].[bookid] = [books].[id] " & _
  7. "order by [transactions].[due date]"
  8.  
  9.             Me.result_list.RowSource = str
but still no record is displayed

Share this Question
Share on Google+
3 Replies


P: 25
i tried to do this

Expand|Select|Wrap|Line Numbers
  1.  str = "select  [books].[id],[books].[title],[transactions].[checked in date],[transactions].[checked out date],[transactions].[due date]" & _
  2. "from transactions " & _
  3. "where [transactions].[checked out to] = " & _
  4. rspatrons![ID] & _
  5. "inner join books " & _
  6. " ON [transaction].[bookid] = [books].[id] " & _
  7. "order by [transactions].[due date]"
  8.  
  9.             Me.result_list.RowSource = str
but still no record is displayed
Jan 7 '12 #2

Rabbit
Expert Mod 10K+
P: 12,366
That's because if you want to use a query as a row source, you can't use value list as the type.
Jan 7 '12 #3

P: 25
i used table/ query
and used a wizard to help me configure the query instead with cross table.

and add the following code.

Expand|Select|Wrap|Line Numbers
  1.   str = "SELECT ID,[title],[checked in date],[checked out date],[duedate] " & _
  2.              "FROM patronlendinghistory " & _
  3.         "Where [checked out to] = " & _
  4.              rspatrons!ID
  5.  
  6.  
  7.             Me.result_list.RowSource = str
Jan 7 '12 #4

Post your reply

Sign in to post your reply or Sign up for a free account.