Solved

data linked forms

Posted on 2001-06-13
7
191 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
Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

 

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

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…

813 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

9 Experts available now in Live!

Get 1:1 Help Now