?
Solved

data linked forms

Posted on 2001-06-13
7
Medium Priority
?
197 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:Vyldryn
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
  • 2
  • +1
7 Comments
 
LVL 2

Expert Comment

by:agriggs
ID: 6186271
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.
0
 
LVL 1

Expert Comment

by:manno
ID: 6186340
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) & ""
0
 

Author Comment

by:Vyldryn
ID: 6186357
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
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Accepted Solution

by:
nerfgunz earned 200 total points
ID: 6192556
Hi Vyldrn,

What type of datacontrols are you using?

You could setup a search code where a datacontrol on the 2nd form queries data based on an identification from the 1st form.

Try something like this:
db2nd.RecordSource = "select * from invoices where myField = '" & frm1stForm.txtDealNumber.Text & "';"

db2nd.Refresh

Good luck.
0
 

Expert Comment

by:nerfgunz
ID: 6192566
You're identification could be anything unique such as what you are using as your primary key in the table.
0
 

Author Comment

by:Vyldryn
ID: 6192912
wow, great help, thanks!  it does exactly what I needed it to do.
0
 
LVL 1

Expert Comment

by:manno
ID: 6194363
The accepted answer is not the most efficient.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question