|
-
Aug 29th, 1999, 05:12 AM
#1
Thread Starter
Lively Member
Hi
I am trying to use a MSFlexGrid to display data from a MSAccess database.
Here is my code. I cant get the grid to show the results.I am very NEW to VB
and any help would be appreciated.
Thanks
Private Sub Command1_Click()
Dim strSQL As String
strSQL = "SELECT * FROM Customer " & _
"WHERE (HomePhone = """ & varHomePhone & """);"
Me.Data2.RecordSource = strSQL
Me.Data2.Refresh
Dim strSQL1 As String
Dim strKey1 As String
strKey = Text1.Text
strSQL = "SELECT * FROM Orders " & _
"WHERE (CustomerID = """ & strKey1 & """);"
Me.Data1.RecordSource = strSQL1
Me.Data2.Refresh
Me.MSFlexGrid1.Refresh
End Sub
-
Aug 30th, 1999, 05:56 PM
#2
Member
I can't really follow the code that you've posted. Here's how I've used the MSHFlexGrid:
1. Use ADO to open a recordset
2. Set the recordset property of the MSHFlexGrid to the ADO recordset.
Dim acon as ADODB.Connection
Dim arec as ADODB.Recordset
'set SQL query
sSQL = string for SQL query
'instantiate connection & recordset objects
Set acon = New ADODB.Connection
Set arec = New ADODB.Recordset
'define connect string
sConnectString = connect string to data source
'make a connection
acon.Open (sConnectString)
'get the recordset
arec.Open sSQL, acon, adoCursor, adoLocking
'set MSHFlexGrid recordset property
Set MSHFlexGrid.Recordset = arec
-
Aug 30th, 1999, 09:38 PM
#3
Member
Sorry if this seems silly but have you set the flex's DataMode to bound and the Datasource property to the datacontrol?
Then refreshing the datacontrol should refil the grid if there are records in the set.
-S
------------------
http://www.smithvoice.com/vbfun.htm
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|