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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

varaible not passing the correct record.

Status
Not open for further replies.

webstaff

Technical User
Jan 2, 2003
97
GB
Hi Guys,

This is my first time here,

Im very new to VB6

I have followed some tutorials on using the data control, data grid etc,

So I have these data Controlls with some text boxes on 1 Form hooked up to my database, i can scroll through the records with the datagrid or the Data control,

I want to be able to choose the record or selected record from these Controls, pass it to another form which will pull records from a query in the database based on matching the passed parimeter's value.

Now I have had a go and it sort of works but not correctly,
I declared a Global variable in my ModMain.bas file "dname"

On my main form I set the value of the variable(dname) as follows:

Private Sub Form_Load()
txtkcname.Refresh
dname = txtkcname.Text
End Sub


with a command button to open up the details form

Private Sub searchButton_Click()
Form1.Show
End Sub


and finaly the Form that opens with the details

Private Sub Form_Load()
Label1.Caption = dname
End Sub


Now it seems to work except the value passed always stays at the very first record in the recordset, is there something i need to do to make the labels caption refresh to the text boxes current value?


Many thanks to anone who can help.

Webstaff

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top