Display results of sql query on form

hbrems

has no clue...
Local time
Today, 23:48
Joined
Nov 2, 2006
Messages
181
Dear all,

I would like to display the results of an sql query on a form. However, the data I want to display are 'confidential' (system, userid & password). One user can have access to several systems.

I have a back end database where are the data is stored. This back end is password protected.

The front end consists of 1 form which allows users to connect to the back end and retreive only their personal records.

So far so good. I'm able to retreive the information and debug.print it. But what is the easiest way to display the information on a form?

Code:
Dim cnnbe As New ADODB.Connection
Dim rstbe As ADODB.Recordset

'connect to back end
cnnbe.Open "Provider=microsoft.jet.oledb.4.0;" & _
    "data source = C:\Documents and Settings\hbrems\" & _
    "Desktop\Accounts\Accounts.mdb;"

'create recordset
Set rstbe = New ADODB.Recordset
rstbe.Open "SELECT * FROM tbluuid " & _
    "WHERE tbluuid.flduuname = " & Chr(34) & txtusername & Chr(34), cnnbe

'clean
rstbe.Close
Set rstbe = Nothing

MsgBox "Done"
 
A form has a property named recordset that you can only access through code. On the forms load event set the forms recordsetproperty to the open recordset. You will have to make the recordset public in order to do so.
 
Thanks Keith, this has helped me indeed. I'm able to open the recordset and display it on the form.

I would say I'm pretty familiar with access but on the other hand totally new to the entire ADO/recordset scene. So I appreciate all the help I can get.

The purpose of the application is to provide users with all their log-in information, without them being to be able to see other users' info.

The next step would be that they can edit the information that is displayed on the screen, correct it, and mail that back to me. But the issue that I now face is that the form is read only.

I presume this is due to the fact that I'm displaying information which is 'bound' to a recordset which is already closed.

Keeping in mind that I don't want to store anything in this database, not even a single temp table, what is the best approach to allow users to edit these fields?

I got the hang of how mailing in Access works, so don't worry about that.

Kind regards,
hbrems
 

Users who are viewing this thread

Back
Top Bottom