avadhutd2
10-12-2009, 06:34 AM
Hi,
I need help for the following situations -
Part (A)
I have a SQL query with me that gives name of the columns from database & its column type. I have to store these values in a listbox1 which is on a userform.
For example
Select Nm, CType from DBName order by CNo ' Here Nm is Name of the column, CType is the Type & CNo is the Column Number.
I need to store Name in column1 of the ListBox1 & Column Type in column2 of the ListBox1. I know that the column count property of a list box allows it to have more than one columns.
I need help as how to make use of recordset to have these two values stored in a listbox1 & how we can use these values ahead.
Part (B)
After having these in ListBox1, I have lines written to transfer the selected item in ListBox1 to ListBox2. Here I am generating the SQL depending on the selections done by the user (in ListBox2).
For example,
If ListBox1 has values A, B, C, D....Z & user select A, B & C, I will be creating a SQL query as
SQL = "Select "
SQL = SQL & ListBox1.List(i) & ", " ....etc
SQL = SQL & "From DBName"
Consider as an example - B & C are DATE Types.
Actually here again I am copying the record set data in the Sheet. But I have to identify & format the DATE Type fields while copying in the Sheet.
I have to make use of the ListBox column property to do that.
I will just summarize...I have to copy the DB values of Name & Column Type in a LISTBOX, User will make his selections to LISTBOX2. I form a SQL to retrieve these selections from DB & Copy the results in Sheet1.
But the requirement here is I should be clear as how to identify & format the DATE fields from the selected items.
I hope the scenarios are clear...can anyone guide me in this matter?
Thanks in advance...
I need help for the following situations -
Part (A)
I have a SQL query with me that gives name of the columns from database & its column type. I have to store these values in a listbox1 which is on a userform.
For example
Select Nm, CType from DBName order by CNo ' Here Nm is Name of the column, CType is the Type & CNo is the Column Number.
I need to store Name in column1 of the ListBox1 & Column Type in column2 of the ListBox1. I know that the column count property of a list box allows it to have more than one columns.
I need help as how to make use of recordset to have these two values stored in a listbox1 & how we can use these values ahead.
Part (B)
After having these in ListBox1, I have lines written to transfer the selected item in ListBox1 to ListBox2. Here I am generating the SQL depending on the selections done by the user (in ListBox2).
For example,
If ListBox1 has values A, B, C, D....Z & user select A, B & C, I will be creating a SQL query as
SQL = "Select "
SQL = SQL & ListBox1.List(i) & ", " ....etc
SQL = SQL & "From DBName"
Consider as an example - B & C are DATE Types.
Actually here again I am copying the record set data in the Sheet. But I have to identify & format the DATE Type fields while copying in the Sheet.
I have to make use of the ListBox column property to do that.
I will just summarize...I have to copy the DB values of Name & Column Type in a LISTBOX, User will make his selections to LISTBOX2. I form a SQL to retrieve these selections from DB & Copy the results in Sheet1.
But the requirement here is I should be clear as how to identify & format the DATE fields from the selected items.
I hope the scenarios are clear...can anyone guide me in this matter?
Thanks in advance...