G
Guest
I have 2 questions regarding recordset. Please help. Thanks in advance.
1. I would like to run a query and then store the results of the query in
the textboxs in a form. here is the code that I write. A error message
occured. There is more than one record in the result of the query.
Dim con As Object
Dim rs As Object
tempstr = “SELECT [table1].[app_no] AS [MI No], [table2].[status]†& _
“FROM table1 INNER JOIN table2 ON [table1].[app_no]=[table2].[app_no]†& -
“WHERE (((Mid([table1].[id],2,7)) Like (Left([forms]![control]![o1],7)))) “
& _
“OR (((Left([table1].[id],7)) Like (Left([forms]![control]![o1],7))));â€
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
rs.Open tempstr, con
record_count = recordcount (rs)
for i = 1 to record_count
ref_temp(i)=rs![mi no]
Me.txtbox.record(i) = ref_temp(i)
next i
2.There is more than 1 record in a form. How could I refer to differnt
records in vb? this is what I have tried.
for i = 1 to 100
temp(i) = me.txtbox1.record(1)
msgbox temp(i)
next i
1. I would like to run a query and then store the results of the query in
the textboxs in a form. here is the code that I write. A error message
occured. There is more than one record in the result of the query.
Dim con As Object
Dim rs As Object
tempstr = “SELECT [table1].[app_no] AS [MI No], [table2].[status]†& _
“FROM table1 INNER JOIN table2 ON [table1].[app_no]=[table2].[app_no]†& -
“WHERE (((Mid([table1].[id],2,7)) Like (Left([forms]![control]![o1],7)))) “
& _
“OR (((Left([table1].[id],7)) Like (Left([forms]![control]![o1],7))));â€
Set con = Application.CurrentProject.Connection
Set rs = CreateObject("ADODB.Recordset")
rs.Open tempstr, con
record_count = recordcount (rs)
for i = 1 to record_count
ref_temp(i)=rs![mi no]
Me.txtbox.record(i) = ref_temp(i)
next i
2.There is more than 1 record in a form. How could I refer to differnt
records in vb? this is what I have tried.
for i = 1 to 100
temp(i) = me.txtbox1.record(1)
msgbox temp(i)
next i