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
263 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
[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
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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

A short article about a problem I had getting the GPS LocationListener working.
This is an explanation of a simple data model to help parse a JSON feed
Progress
Starting up a Project

705 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