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
251 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
groupNoAdj 7 84
creating threads in delphi 1 81
Rubik's Cube Code for Effective Presentation 3 40
Advice in Xamarin 21 47
RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

929 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

11 Experts available now in Live!

Get 1:1 Help Now