Dataset opening position

Johnnh

Member
Joined
May 5, 2006
Messages
6
Programming Experience
Beginner
Hello

Can anyone advise please

I am using the dataform wizard to access a ms access database. When it loads, the data shown is that of record1 in the database. Is there anyway of getting it to load a predefined record ie no2 of 5 instead of always going to the first record.

Purpose
What I intend on doing is selecting a record from another form passing the related record number so when the dataform opens the record is loaded .All the connections are in place and i have the record no ie primary key field being passed by public variable to the dataform, but im unaware if it can be assigned as a postion to which record the dataset initally displays

Many thanks
 
If you haven't already then bind you data to a BindingSource and then your BindingSource to your control(s). You then simply set the Position property of the BindingSource to the index of the record you want selected.
 
Hello

Can anyone advise please

I am using the dataform wizard to access a ms access database.
Data Form wizard doesnt exist in .Net 2.0 / VS2005
Please either correct your forum profile to the version of .NET youre using, or use the correct terminology for what you ARE using..

When it loads, the data shown is that of record1 in the database. Is there anyway of getting it to load a predefined record ie no2 of 5 instead of always going to the first record.
I'm assuming you really are on .NET 2, and by Data Form Wizard you mean the dataset generator. I'm also guessing youve left the default query in place, which loads all records from the database (Yeah, not a good idea :) ). Consider changing it or adding another query that selects a record based on some criteria (PK is a good one?!) and use that to fill your set instead


DW2 link in signature. Section: Creating a form to Search Data
 
Back
Top