Solved

How do i open Form2 with the details of Contract#1 using the value from the listbox on Form1?

Posted on 2006-06-15
6
246 Views
Last Modified: 2010-04-17
Dear Experts...

I have a Form1 - [Topic Information] with a list box that contains 3 columns:
1) the Contract_ID (hidden)
2)the Contract_Number
3)the SBIR_Phase

What I want to do, is select a value from my list box - "lst_Contract_Number" and open up a "Contract Details" page  by passing it the hidden Contract_ID field from the [Topic Information] page. This is what I have so far. I am a ENTRY LEVEL programmer, so please make any expanation Barney Style! :-)

Thanks in advance

 sql = "SELECT [Contract Information].[Contract Number],[Contract Information].SBIR_Phase,[Contract Information].Contract_ID,"
 sql = sql & " Funding_Details.Contract_ID from [Contract Information] RIGHT JOIN Funding_Details on Funding_Details.Contract_ID = [Contract Information].Contract_ID"
 sql = sql & " Where [Contract Information].Contract_ID = lst_Contract_Number.Column(1, 1)"

0
Comment
Question by:changalang
6 Comments
 
LVL 4

Expert Comment

by:programmer1024
ID: 16916757
Um..what language? Access, Oracle, VB.NET?
0
 
LVL 2

Expert Comment

by:T3Logic
ID: 16924698
c#, asp.net c#
http://www.codeproject.com/useritems/pass_data_between_forms.asp

http://msdn2.microsoft.com/en-US/library/ms171925.aspx

I for one mainly develop in c# now, c++ before.  So I usually

create a "get, set" function in the form I want to pass the data.

Form 1:
<before the open new form function>

string myString = "2";
Form2 myForm2 = new Form2();
myForm2.form2MyString = myString;
myForm2.Open();


Form 2:

private string strForm2MyString;
public form2MyString
{
     get
     {
          return strForm2MyString;
     }
     set
     {
          strForm2MyString = value;
     }
}


Now I can use "strForm2MyString" anywhere in Form2 when I need that value.

Hope this helps.


0
 

Author Comment

by:changalang
ID: 16944427
Sorry guys, this is in Access 2003
0
 

Author Comment

by:changalang
ID: 16944479
I figured it out with the help of a colleague here. This is what I got to pass the value over to the next page, a variable, tmpcol:

   If Len(Nz(Me![lst_Contract_Number].ItemData(Me![lst_Contract_Number].ListIndex + 1))) > 0 Then
            tmpCol = Me![lst_Contract_Number].ItemData(Me![lst_Contract_Number].ListIndex + 1)

And then this is my WHERE clause: WHERE [Contract Information].Contract_ID = " & Me.OpenArgs

Thanks for all your help T3Logic!
0
 

Accepted Solution

by:
CetusMOD earned 0 total points
ID: 17257024
PAQed with points refunded (500)

CetusMOD
Community Support Moderator
0

Featured Post

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!

Join & Write a Comment

A short article about a problem I had getting the GPS LocationListener working.
Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

708 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

13 Experts available now in Live!

Get 1:1 Help Now