Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

data linked forms

Posted on 2001-06-13
7
Medium Priority
?
200 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
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

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

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
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.
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

618 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