i have a problem in my program.... i want to link the database in the search form1 to form2 ... what was the code.. the code is in below... what is the error and what is the proper code of this....

this is my form 1 code that link to my form2...

Private Sub cmdsearch_Click()
Form8.txtidno.Text = Form4.txtidno.Text
Form8.txtborrowname.Text = Form4.txtborrowname.Text
Form8.txtcourse.Text = Form4.txtcourse.Text
Form8.txtyear.Text = Form4.txtyear.Text
Form8.txtnf.Text = Form4.txtnf.Text
Form8.txtbooktittle1.Text = Form4.txtbooktittle1.Text
Form8.txtacc1.Text = Form4.txtacc1.Text
Form8.txtauthor1.Text = Form4.txtauthor1.Text
Form8.txtcall1.Text = Form4.txtcall1.Text
Form8.txtdatedue.Text = Form4.txtdatedue.Text
Form8.txtdatereturn.Text = Form4.txtdatereturn.Text
Form8.txtborrowed.Text = Form4.txtborrowed.Text
End Sub
......

and this is my second form code..

Private Sub Form_Load()
Form4.txtidno.Text = Form8.txtidno.Text
With Data1.Recordset
            a = Form4.txtidno.Text = Form8.txtidno.Text
            .FindFirst "[IDno]='" & a & "'"
                If .NoMatch Then
              MsgBox "The Information is not Recorded.!", vbInformation, "Search"
                ElseIf vbYes Then
                Form4.txtborrowname.Text = Form8.txtborrowname.Text = .Fields("borrowname")
                Form4.txtcourse.Text = Form8.txtcourse.Text = .Fields("course")
                Form4.txtyear.Text = Form8.txtyear = .Fields("year")
                Form4.txtacc1.Text = Form8.txtacc1.Text = .Fields("acc1")
                Form4.txtbooktittle1.Text = Form8.txtbooktittle1.Text = .Fields("booktittle1")
                Form4.txtauthor1.Text = Form8.txtauthor1.Text = .Fields("author1")
                Form4.txtcall1.Text = Form8.txtcall1.Text = .Fields("call1")
                Form4.txtdatereturn.Text = Form8.txtdatereturn.Text = .Fields("datereturn")
                Form4.txtborrowed.Text = Form8.txtborrowed.Text = .Fields("borrowed")
                Form4.txtdatedue.Text = Form8.txtdatedue.Text = .Fields("datedue")
                Form4.txtnf.Text = Form8.txtnf = .Fields("transactions")
            End If
            
End With
End Sub

.....
i want to link the data inside the form1 to form2 ...
and what is the code of that.....

Recommended Answers

All 5 Replies

Hi,
Write the property in the form with get set values...
and set the values based on that. hope this will give you an idea

Hi,
Write the property in the form with get set values...
and set the values based on that. hope this will give you an idea

...............


tnx.. i'll try it!

I really do not understand why are you setting the values back and forth from and to the same control.

Why not use variables with wider scope.

Hi debasis das Is it not good idea to have property then having variables with wider scope?

Yes , of-course.

I never disagree without on that.

Always there are multiple ways of achieving the same goal.

What i suggested was just another work around.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.