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

Synch forms

Status
Not open for further replies.

TennesseeFox

Programmer
Jul 24, 2004
14
US
Im positive this question has been asked before, but I cant find it in a search.

I have a database that has a Main Form. On the Main Form there is a button to open a Child Form for additional information. The Record Number is the main identifier. I need to pass the Record Number on the Main Form to the Child Form so the additional information is linked to the main Record Number. In Access it was as easy as putting
=[form][form1][recordnumber] in the text box. How do I do it in VB.net

Also, does anyone know of a good reference that has these ultra common questions answered. MS knowledge base doesnt help and most books ive scanned thru dont have the basics like the code to open a new form or close one...

Thanks for your help

Tennessee
 
in your mainform
Code:
dim f as new childform
f.show
f.textboxwithrecordnumber.text = me.textboxrecordnumber.text

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
That works! now how and where do i put the code for this

when the child opens it displays the same record as the parent, but the child opens to record 1 (but it shows whatever number the parent was)

how do I goto record 4 on the main. hit the child and have it open record 4 on the child, or create a new record if there is no 4 on the child??
I ve tried the addnew() but I put it in the main, I think it need to go on the child, maybe during the load?

Thanks again
 
after addnew you should do an endcurrentedit.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
ive tried that too. this is the current code im working with
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
On Error GoTo Err_Button2_Click
Dim VehicleEntry As New VehicleEntry
Dim objVeh As DataSet
VehicleEntry.Show()
VehicleEntry.editRecordNumber.Text = Me.editRecordNumber.Text
'Clear out the current edits

Me.BindingContext(objVeh, "Subject_Vehicle").AddNew()
Me.BindingContext(objVeh, "Subject_Vehicle").EndCurrentEdit()

End

Exit_Button2_Click:
Exit Sub

Err_Button2_Click:
MsgBox(Err.Description)
Resume Exit_Button2_Click

End Sub


someone suggested that I would have to write a query to tell the vehicle tble to pull up that record number and display it, and if there wasnt one add a new record with that record number. But I dont know where to put it (in the child form maybe) and how to write it...any ideas? or samples somewhere I could build from? Ive looked on msdn but they dont go into that much detail

Thanks for all your help

Tenn
 
Oh and with this code I get a : Fill:selectCommand. Selection property has not been intialized. error when I open the child form




 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top