Solved

userform needs a subform

Posted on 2011-02-23
8
480 Views
Last Modified: 2012-05-11
excel 2003 vba
access 2003

 What I have:
A userform but trying to display items being rectrned in a recordset(from access) like a subform. On my userform.

What I need for now...
I have a listbox to hold my records in the return recordset.
However it is not displaying them properly. Like a list...
they are just on one single line.

'Create a Snapshot Type Recordset from the SQL query
Set rstFromQuery = dbsEAIQuote.OpenRecordset(strSQL, dbOpenSnapshot)


'Move to the last record in the recordset
rstFromQuery.MoveLast

With frmiCart.ListBox1
    .ColumnCount = rstFromQuery.Fields.Count
          .Column = rstFromQuery.GetRows(rstFromQuery.RecordCount)
End With


Maybe the listbox is the only way to create a subform in excel ?

anyway I need all records to show as a list in listbox1 ?

Thanks
fordraiders






 
0
Comment
Question by:fordraiders
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 4
8 Comments
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34965788
Use:
 .List= Application.Transpose(rstFromQuery.GetRows())

Open in new window

0
 
LVL 3

Author Comment

by:fordraiders
ID: 34966520
not working...error
With frmiCart.ListBox1
 
    .ColumnCount = rstFromQuery.Fields.Count
          .Column = rstFromQuery.GetRows(rstFromQuery.RecordCount)
.List = Application.Transpose(rstFromQuery.GetRows())   <------  "no  current record"

End With
0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34967923
I meant use that instead of your .column =... line
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 3

Author Comment

by:fordraiders
ID: 34969863
rorya, I did.
STILL ERROR 3021    no current record...

this way:
With frmiCart.ListBox1
     .ColumnCount = rstFromQuery.Fields.Count
 .List = Application.Transpose(rstFromQuery.GetRows())
End With

this way:
With frmiCart.ListBox1
     .List = Application.Transpose(rstFromQuery.GetRows())
End With



0
 
LVL 85

Expert Comment

by:Rory Archibald
ID: 34969869
You probably need to MoveFirst before you use GetRows.
0
 
LVL 3

Author Comment

by:fordraiders
ID: 35036869
ok tried that...  rorya..not working
0
 
LVL 85

Accepted Solution

by:
Rory Archibald earned 500 total points
ID: 35036922
Hmm, maybe DAO requires the number of rows to retrieve:
With frmiCart.ListBox1
     .ColumnCount = rstFromQuery.Fields.Count
 .List = Application.Transpose(rstFromQuery.GetRows(rstFromQuery.Recordcount))
End With

Open in new window


If that still doesn't work, can I see the full code, please?
0
 
LVL 3

Author Closing Comment

by:fordraiders
ID: 35112345
ok thanks
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction This Article briefly covers methods of calculating the NPV and IRR variants in Excel as well as the limitations in calculating and interpreting IRR results. Paraphrasing Richard Shockley, author of my favourite finance reference tex…
Excel can be a tricky bit of software to get your head around. Whilst you’ll be able to eventually get to grips with the basic understanding of how to get by, there are a few Excel tips that not everybody will even know about let alone know how to d…
This Micro Tutorial demonstrates in Microsoft Excel how to consolidate your marketing data by creating an interactive charts using form controls. This creates cool drop-downs for viewers of your chart to choose from.
This Micro Tutorial will demonstrate how to create pivot charts out of a data set. I also added a drop-down menu which allows to choose from different categories in the data set and the chart will automatically update.

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question