Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 28th, 2004, 05:36 AM
Registered User
 
Join Date: Jun 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Add field to top of recordset

Hi!

I have a recordset with data from a database and I bind it to a MSHFlexGrid.

Problem is that I need to set the value of the 1st row of that grid. So I either have to fill the 1st row of the recordset and then bind it to the FlexGrid or have fill the 1st row of the FlexGrid and then bind the recordset to it. I'm having all kind of problems with this 2 solutions... :( Inserting the 1st row I want to the database and then retrieving the table to the recordset isn't a solution amongst other things because of data type. So what do I do now?

Thanks!

Rui
 
Old July 7th, 2004, 10:43 PM
Authorized User
 
Join Date: Jul 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

the solution would be is to insert the row you want into A TEMP table then insert the rows you want into that TEMP table and retrieve that table into your recordset. If your concerned about the data type, my question is why do you have to insert a row in the GRID that is not of the same data type (column) as with the other values in that column?

 
Old July 8th, 2004, 09:40 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
Send a message via MSN to gbianchi
Default

hi all...

bluefrench option is very good.. but i will also ask you.. why do you need that?? maybe there is a better solution if you xplain what are you train to accomplish...

HTH

Gonzalo
 
Old July 8th, 2004, 09:48 AM
Registered User
 
Join Date: Jun 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi All!

What I was trying to do was to have a FlexGrid with data (i.e. Part Numbers) that I could drag and drop to a textbox. The 1st item on the Grid would be "New Part" so that if I dropped it into the textbox and pressed a button, it would create a new part. (it's a bit more complicated than this. I simplified so that it would be easy to explain).

What I ended up doing was to create a button that when pressed creates a new Part Number. It's not a great solution from the usability point of view but it works. Parsing a temp recordset/flexgrid was too time consuming so it wasn't an option.

Thanks for the input guys!

Rui

 
Old July 11th, 2004, 11:58 PM
Authorized User
 
Join Date: Jul 2004
Posts: 18
Thanks: 0
Thanked 0 Times in 0 Posts
Default

you wouldn't have a temp recordset from what i suggested. it's not clear to me what you wanted to do, though. but if you could clear it more i would be glad to help.

 
Old July 14th, 2004, 02:36 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 128
Thanks: 0
Thanked 0 Times in 0 Posts
Default

If you want to have the first record be "New Part" what I might suggest is to create a field in your database named Priority set all values to zero. Set the "New Part" record Priority to one. Link the Flexgrid to a query and have the ORDER BY clause Priority Desc. If the query is dynamic always ensure the first parameter in the ORDER BY clause is Priority Desc and do not allow users to change, access, or sort by the Priority field. This will always keep the new part record at the top of the view.

Hope this helps.

Larry Asher
 
Old July 14th, 2004, 03:24 AM
Registered User
 
Join Date: Jun 2004
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Nice idea xgbnow. Thanks!






Similar Threads
Thread Thread Starter Forum Replies Last Post
using an IF statement with a recordset field melkin Classic ASP Components 3 March 20th, 2008 03:04 PM
bind recordset to field ibgreen SQL Language 0 October 24th, 2006 12:48 PM
Retrieve recordset field value tryntolearn Classic ASP Databases 1 August 8th, 2005 10:22 AM
how to add new column to recordset?? huela Access VBA 0 October 13th, 2004 01:22 PM
Add Datetime to Recordset martinaccess Access 2 October 10th, 2004 07:30 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.