to show a recordset as table

M

michele de meo

I use this vba code after to connect Access to a remote db. I obtain a
recorset and I want to show it as "table". I bind this recordset to a
form, but how to show as table?
This is the code (associated to a clik of a command botton):

Set recSet = New ADODB.Recordset

With recSet
Set .ActiveConnection = con 'con is the connection
defined above in the code
.Source = "select var1 from datamart where rix=4"
.LockType = adLockBatchOptimistic
.CursorType = adOpenKeyset
.CursorLocation = adUseClient
.Open
End With

Set Me.Recordset = recSet


After this code I correctly bind the recordset to the form , and if I
set the Form to "spreadsheet", I obtain a table with the just number of
records but without fields......

Someone could hel me?
thanks

michele de meo
 
M

michele de meo

Alex Dybenko ha scritto:
Hi,
try to add a textbox to your form and set it control source property to var1

How to do it?
If the textobx is "txt1" then in the code:

Set Me.txt1.? = ?

thanks

michele de meo
 
M

michele de meo

Alex Dybenko ha scritto:
Hi,
Me.txt1.ControlSource="var1"

this you have to do before binding form to recordset


Ir doesn't works. :-(
I obtain only a txt with #Nome?......

thanks
 
M

michele de meo

michele de meo ha scritto:
Alex Dybenko ha scritto:


Sorry!!!!!!!!!!!!!!
I obtain a form with a txt in wich I can see the first value of the
recordset.
By displaying the form as "spreadsheet" I obtain a table with the just
number of records, but with empty cell :-(

thanks
mdm
 
M

michele de meo

Alex Dybenko ha scritto:
Hi,
Me.txt1.ControlSource="var1"

this you have to do before binding form to recordset
--


Dear Alex,
after many attempts, I obtain the result woth your advise!!!!!!!
THANK YOU
and now, after the click of a command botton, I'd like to obtain the
form directly as table.
Can I set directly the propriety of the form as "table" (without to
force the final user to set this propriety directly by the wizard)?

thank you!!!!!

mdm
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top