PDA

Click to See Complete Forum and Search --> : Anyone know how to use Data Controls?


Stockton.S
Oct 9th, 2000, 07:56 AM
I have two adodc controls on the form am I want to extract some data from one record and reference that against another data source and display the answer.

The code is as follows



Function Search_PN()
Dim strSQL As String
Dim MAXData As ADODB.Recordset
Dim maxfield As ADODB.field


Dim strSQLstatus As String
Dim StatusCode As ADODB.Recordset
Dim statusfield As ADODB.field


Dim Count As Integer
Count = -1
'ProductData.Mav_DB.Open



strSQL = "SELECT uzdload.dload_item, uzdload.dload_descext, uzdload.dload_drawiss, uzdload.dload_striss, uzdload.dload_status, uzdload.dload_stitem, uzdload.dload_stiss" & " FROM uzdload" & " WHERE uzdload.dload_item = " & Chr(39) & frmSearch.DataComboPN.Text & Chr(39) & Chr(59)

'Identifies which ADO connection is being used for SQL.
frmSearch.maxdatasource.RecordSource = strSQL
Set MAXData = frmSearch.maxdatasource.Recordset

For Each maxfield In MAXData.Fields
Count = Count + 1

If maxfield.Name = "dload_status" Then
strSQLstatus = "SELECT mmiss.mmiss_code" & " FROM mmiss" & "WHERE mmiss.mmiss_code =" & Chr(39) & maxfield.Value & Chr(59)
frmSearch.mmissdatasource.RecordSource = strSQLstatus
Set StatusCode = frmSearch.mmissdatasource.Recordset
With StatusCode.Fields
frmView.MAXData(Count) = statusfield.Value
End With
Else
frmView.MAXData(Count) = maxfield.Value
End If
Next

MAXData.Close
Set MAXData = Nothing

End Function

moyalt
Oct 9th, 2000, 07:14 PM
Hello ,
Well i recently started working with database in vb6
so i don't know the answer. but i recently downloaded a book of 730 pages in vb database - excellent book!
in pdf file ,if you want this file reply me and i'll send
you.
(moyalt@zahav.net.il)