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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Java Loop 6 67
VBSCRIPT string remove all characters to the right after extension 4 66
Full Screen problem when auto scale IFRAME 2 101
Create .bat File 16 23
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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.
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

809 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