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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Does the idea of dealing with bits scare or confuse you? Does it seem like a waste of time in an age where we all have terabytes of storage? If so, you're missing out on one of the core tools in every professional programmer's toolbox. Learn how to …
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

749 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