Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to show DataCombo 1st Value

Status
Not open for further replies.

muraliambt

Programmer
Jan 22, 2002
75
0
0
US
Hi,

1. i have datacombo bounded with recordset. When i open the form i want show the first value of the column.

Set dcomPrd.RowSource = rsProd
dcomPrd.ListField = "pr_name"
dcomPrd.BoundColumn = "pr_code"

I want to show the first Product Name.

Thanks
Muraliambt.

 
If you make sure the recordset is on its first record (rsProd.MoveFirst), dcomPrd.Text will hold the first value of the listed field, and dcomPrd.BoundText will hold the first value of the bound column.
 
Hi,

Tks for the reply. is there anyway i can position the record field like 3rd or 5th.

Muraliambt.
 
Well, every rsProd.MoveNext command you execute will move you forward by one, so you could loop a number of them depending on which record you need to move to. But you'll have to build in a safeguard against going past the end of the recordset, as trying a MoveNext when you're at the end will raise an error. Several ways to handle that, such as trapping the error with an On Error routine, or preventing it from happening in the first place by testing the rsProd.EOF condition with an if before you try to move on to the next record.



"Any fool can defend his or her mistakes; and most fools do." -- Dale Carnegie
 
Hi,

Even if i say rsprod.movefirst after clearing the datacombo, still it is now showing the first record.

I want like this...

when the user cliks "Add" button i am clearing all the Text Fields, combo box and data combo.

Textfield.text =""
combo.text = ""
datacombo.text = ""

After clearing i want to position all the Datacombo Box with 1st Records meaning it should show the Code or Name whatever specified in the ListField.

Tks,
Muraliambt.






 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top