Link to home
Start Free TrialLog in
Avatar of Vyldryn
Vyldryn

asked on

data linked forms

Hi.  I'm trying to write a database program in VB.  However, there is one form which cannot hold all the information on it at the same time, so I created a second form to hold the rest of the info.  The problem is that on the first form, there is a data control which is used to scroll through the different records.  How do I make it so that when I scroll, the information on the second form also scrolls with it (i.e. if i bring up the second form, the info on the second form will match the record displaying on the first)?

I tried doing the following, but it's giving me an error, "Invalid use of null".  Can someone help me fix this please?

txtPayment.DataField = txtEnterInvoices.dbFairbanx.Recordset.Fields("PYMNTRCVD")

txtPaymentDate.DataField = frmEnterInvoices.dbFairbanx.Recordset.Fields("PYMNTDATE")

-Vyl
Avatar of agriggs
agriggs

Why not use two tabs on the same form, like most programs do?  Set a reference to Microsoft Windows Common Controls, then drop a tabstrip onto your form, then move your controls from one form onto the top tab, and move your controls from the other form onto another tab.

I haven't solved the problem you asked about, but I never use bound controls.

Good luck.
You can put a second Data Control on form2, and...

Set form2.dCtrl = form1.dCtrl

Also, you get Invalid Use of Null because you're trying to assign the default value of the Field object to the Datafield of the textbox. The default value is Value (ie what's in the field).

txtPaymentDate.DataField = "PYMNTDATE"


Incidentally, you can get round Invalid Use of Null when trying to put a Null field into something by adding an empty string:

(field) = (nullvalue) & ""
Avatar of Vyldryn

ASKER

I will try this...but I can't seem to find the Common Controls reference in my reference list.  What is it called in the references list?

- Vyl
ASKER CERTIFIED SOLUTION
Avatar of nerfgunz
nerfgunz

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
You're identification could be anything unique such as what you are using as your primary key in the table.
Avatar of Vyldryn

ASKER

wow, great help, thanks!  it does exactly what I needed it to do.
The accepted answer is not the most efficient.