Solved

data linked forms

Posted on 2001-06-13
7
189 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
  • 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
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 

Accepted Solution

by:
nerfgunz earned 50 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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 Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

744 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

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now