azizsohail
New member
- Local time
- Today, 19:55
- Joined
- Jul 11, 2011
- Messages
- 7
hi there,
I am working on ADP project in Access 2010. SQL server 2008.
There are 2 forms, FormA and FormB
on Form A. i got a listbox,,, which got a few columns. when i double click on any row of the listbox, its pick up the value in the first column and pass it to SQL stored Procedure which returns some data .......
Dim rsData As ADODB.Recordset
Set rsData = New ADODB.Recordset
Dim srtqry As String
rsData.ActiveConnection = CurrentProject.Connection
rsData.CursorType = adOpenDynamic
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = CurrentProject.Connection
Cmd.CommandText = "ICT_Reports_Load_ProjectDetailForUpdate"
Cmd.CommandType = adCmdStoredProc
Cmd.Parameters.Refresh
Cmd.Parameters(1).Value = Me.listsearch.Column(0)
Set rsData = Cmd.Execute()
DoCmd.OpenForm "FormB"
' loading FormB ......
'there is a combo Named Application Combo on formB
' in the formB load event. there is some code tofill in the ApplicationCOmbo
' with data
forms!formB!ApplicationCOmbo.Column(1).value=RsData(0)
The above line give me error. I need to set the value to that returned by the stored Procedure... but i also want the whole list to be there in the combo as well.
the reason i want to do comparison with column 1 of the Application combo is that Application combo got 2 columns.
number 1 hidden code column means 0cm width.
number 2 is discription field 4 cm width.
Can you please guide me with this ?
Private Sub Form_Load()
Me.ApplicationCombo.RowSource = "SELECT Code_ID, Description_VC FROM dbo.Shared_Codes_T WHERE (Type_ID = 2) ORDER BY Description_VC"
End Sub
I am working on ADP project in Access 2010. SQL server 2008.
There are 2 forms, FormA and FormB
on Form A. i got a listbox,,, which got a few columns. when i double click on any row of the listbox, its pick up the value in the first column and pass it to SQL stored Procedure which returns some data .......
Dim rsData As ADODB.Recordset
Set rsData = New ADODB.Recordset
Dim srtqry As String
rsData.ActiveConnection = CurrentProject.Connection
rsData.CursorType = adOpenDynamic
Set Cmd = New ADODB.Command
Cmd.ActiveConnection = CurrentProject.Connection
Cmd.CommandText = "ICT_Reports_Load_ProjectDetailForUpdate"
Cmd.CommandType = adCmdStoredProc
Cmd.Parameters.Refresh
Cmd.Parameters(1).Value = Me.listsearch.Column(0)
Set rsData = Cmd.Execute()
DoCmd.OpenForm "FormB"
' loading FormB ......
'there is a combo Named Application Combo on formB
' in the formB load event. there is some code tofill in the ApplicationCOmbo
' with data
forms!formB!ApplicationCOmbo.Column(1).value=RsData(0)
The above line give me error. I need to set the value to that returned by the stored Procedure... but i also want the whole list to be there in the combo as well.
the reason i want to do comparison with column 1 of the Application combo is that Application combo got 2 columns.
number 1 hidden code column means 0cm width.
number 2 is discription field 4 cm width.
Can you please guide me with this ?
Private Sub Form_Load()
Me.ApplicationCombo.RowSource = "SELECT Code_ID, Description_VC FROM dbo.Shared_Codes_T WHERE (Type_ID = 2) ORDER BY Description_VC"
End Sub