
Can't change recordsource property in new form
I'm using VB5 learning edition, I have two forms, linked to the same
database(an address book style affair) The first form performs a search
function through building an SQL query and putting the a limited number of
fields (ie Name, Phone) in a DBGrid. Next I want the user to be able to
DblClick on the required record in the grid to load a new form with all of
the other fields( name, phone, address, favourite pizza etc.)
at the moment my code looks like this in the first form;
Private Sub DBGrid1_DblClick()
Dim HSID As Long
'Primary key
Dim HSqry As String
'Query to insert in recordsource
HSID = DataHS.Recordset.Fields("HSID").Value 'extract unique index
from record clicked
HSqry = "Select * from Homestay where HSID = " & HSID 'Build Query
Load frmProvider 'Load
second form(with all fields showing)
'insert query
frmProviderDatabase.DataHomestayDatabase.RecordSource = HSqry
frmProvider.Show (0)
'show form
frmProvider.DataHomestayDatabase.RecordSource = HSqry 'I tried to insert
it here too
End Sub
I have altered the recordsource property at design with no effect. Do I
need to pass the query to the second form. Probably very simple I know..
Thanks for any help
Russ