List Box bound column

  • Thread starter Thread starter GDW
  • Start date Start date
G

GDW

I want to change the listbox boundcolumn dynamicly by associating it with a
OnClick event. I've looked through the help file but when I try
Me.lbName.BoundColumn = 1
or
Me.lbName.BoundColumn (1)
I either get nothing or "Invalid use of property

Is there a way to change the a listbox boundcolum in this manner?

Gary
 
Gary

It sounds like you've already determined the approach you want to make work.
Perhaps if you describe the "why", the 'group readers can offer another
approach.
 
Hi Jeff,
My goal is to update one table using paired list boxes using
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsmart04/html/sa04e1.asp
and using them to move fields from one table to another. What I am trying
to do is move selected, or all of the fields from one list box/table to
another listbox/table. Maybe there is an easier way to do this then using
MSDN's example. I am trying to learn MS Access as much as develop a DB.

I have three fields that I want to move; DayNumber, fkyClassTime, and
ClassDescription. The ClassDescription is a concatenation of 3 fields
Inserted into tblSource from SQL. I also want to keep the ClassDescription
in DayNumber/ClassTime order in both tables.

I can get one of the fields to move from one table to the other but not the
remaining two. I thought if I could dynamically change the BoundColumn
property I could accomplish this. Is there a better way?

Here is the code (with some of my own modifications) from the above URL;

Private Sub btnSelect_Click()
Dim rsSource As DAO.Recordset
Dim rsDestination As DAO.Recordset


If Me.lbSource.ItemsSelected.Count = 0 Then
Beep
Exit Sub

End If

Set rsSource = CurrentDb.OpenRecordset("tblSource", dbOpenDynaset)
Set rsDestination = CurrentDb.OpenRecordset("DestinationTable",
dbOpenDynaset)

For Each itm In Me.lbSource.ItemsSelected

rsDestination.AddNew
MyData = Me.lbSource.ItemData(itm)
rsDestination!Description = Me.lbSource.ItemData(itm)

rsDestination.Update
rsSource.FindFirst "Description = '" & Me.lbSource.ItemData(itm) &
"'"

rsSource.Edit
rsSource.Delete

Next itm

Me.lbSource.Requery
Me.lbDestination.Requery
End Sub
----- Original Message -----
From: Jeff Boyce
Newsgroups: microsoft.public.access.forms
Sent: Sunday, December 26, 2004 8:49 AM
Subject: Re: List Box bound column


Gary

It sounds like you've already determined the approach you want to make
work.
Perhaps if you describe the "why", the 'group readers can offer another
approach.
 
Gary

Thanks for the description. So, you want to "move" fields from one table to
another...

Hmmm? Why? Not to sound like a broken record, but there are often many ways
to accomplish a perceived business need..Again, it sounds like you've
determined a solution (move fields). But what is the problem?

I can imagine one situation in which moving fields/rows might seem to be a
solution, say, in "archiving" records. But there is a much simpler solution
that doesn't require any movement at all.

So, at the risk of annoying you by repeating myself, what do you want to
accomplish (not how)?
 
Jeff,
At the moment, I was trying to learn how move fields using the paired list
boxes.

Here is what I ultimately would like to do;

I have four ClassSessions each year (Winter, Spring, Summer, & Fall)
Each class Session consists of many Classes (i.e. Monday, 7:00pm, Beginner,
Tuesday 7:00pm Beginner)- although the sessions
do not always contain the same classes.
I want to have a list of Classes so the user can create (move) the Classes
into a ClassSession - (Paired list boxes?).

There are Students who own Dogs.
Each Student's Dog can Register for any (more than one) Class in any
ClassSession.

I have to say I have struggled with the relationships between Student -
Dog - Registration - ClassSession - Class
The relationships between the Students and dog was easy for me. (one to
many), but the remaining relationships have been a struggle.

Also, I am very much a rookie with MS Access. I live in the boondocks and I
decided to learn how to create DB's with Access. Learning it, VB, SQL has
been a little overwhelming. But, I am enjoying the process.

For a long time I avoided using Newgroups because I didn't feel confident
enough about asking the right questions. Learning, is my biggest goal.
Sooner or later I will have enough education to develope something.

Gary
 
Back
Top