Kamis, 06 Oktober 2011

[MS_AccessPros] Re: Populating an unbound textbox with multi item field

 

John;
The row source is another table (tblStations) that populates the dropdown, the tblTrains has a field "stations_Served" that is a list of all the stations/towns that the train does work, so by definition it is potentially a multiple item field (some trains only work one station, however). The field contains the "ID"s for the stations in a comma delimited list of numbers. I can't get it to display anything if the field has more than one item in it and I can't get the drop down to allow multiple entries,
The code generates "SList" perfectly but it won't assign to "SSxx" combo box but I get no error messages.
Walter

--- In MS_Access_Professionals@yahoogroups.com, "John Viescas" <john@...> wrote:
>
> Walter-
>
> If the initial value of Counter is 0, then you need to do:
>
> For i = 0 To Counter - 1
> SList = SList & StationList(i) & ","
> Next i
> ' Strip off the last comma
> SList = Left(SList, Len(SList) - 1)
>
> If the SSxxx control is a combo box, perhaps you mean to set the RowSource, not
> the value of the control?
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
>
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of nkpberk
> Sent: Thursday, October 06, 2011 1:21 AM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] Re: Populating an unbound textbox with multi item field
>
>
>
>
> Hi All;
> I did some more research on the problem below and was able to come up with this;
> 'deal with multi valued field
> Set ChildRS = rst!Stations_Serviced.Value
> Do Until ChildRS.EOF
> ChildRS.MoveFirst
> Do Until ChildRS.EOF
> StationList(Counter) = ChildRS!Value.Value
> ChildRS.MoveNext
> Counter = Counter + 1
> Loop
> SList = StationList(0)
> For i = 1 To Counter - 1
> SList = SList + "," & StationList(i)
> Next i
> Me("SS" & Format(Cnt, "00")) = SList
> Loop
>
> Where SList is a comma delimited string of the ChildRS!Value.Value's, if SList
> contains only one item it works fine, more than that and I get a blank combobox
> on the form. I found that a lookup combobox in a table allows for multiple
> selections one on a form does not (What is with that?)
> Is there a way to make this work?
>
> Walter Griffin
>
> --- In MS_Access_Professionals@yahoogroups.com, "nkpberk" <wgriffin48@>
> wrote:
> >
> > Hi Group;
> > Back with more near impossibilities :-)
> > Expanding on A.D.'s faux continuous form (the color box thing) I also have a
> field in my "trains" table that has a multiple entry field called
> "Stations_Serviced" indicating what towns/station car pickup and setout takes
> place, Some trains have more than one location to work.
> >
> > Anyway, the control is "SSxx" a combobox populated by my "Stations" table and
> the "IDStation" times how many, is saved to the tblTrain!Stations_Served
> > field. Is there a way to make this work with an unbound combobox?
> >
> > I get an error message "64224 Method 'Collect' of object 'recordset2' failed"
> >
> > I cannot find any reference to this in "Help" so this is cryptic at best.
> >
> > Walter Griffin
> >
>
>
>
>
> ------------------------------------
>
> Yahoo! Groups Links
>

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar