get to record source

V

Vsn

Hello all,

I possibly posted this request in the wrong news group yesterday, jet
another try:

I try to make a report where I need the fields fPersID and fPersName
printed, this goes in a textbox no problem. Now I need, in my VBA code, the
data from the field fTestField to see what the code should do next. I
thought I could get this code like stgX = me![fTestField], this however
gives and error (2465).

I do set the record source for the report as below at the Report_Open event.

Rsrc = "SELECT fPersID, fPersName, fTestField FROM tblPers"
Me.RecordSource = Rsrc

I would like to set Me.txtTest = to the fTestField date, which is in the
record source.

Can someone tell me how I can get access to the data fTestField without
linking this to a field/text box on the report.

Thx a lot.

Ludovic
 
D

Duane Hookom

The general method of referencing a field value from the report's record
source from code is to bind a control to that field. The control doesn't have
to be visible.
 
V

Vsn

Thx, I will use the below adviced method. I though it would be possible to
access data in the record source of the report, without linking this data to
a field in the report.

Ludovic


Duane Hookom said:
The general method of referencing a field value from the report's record
source from code is to bind a control to that field. The control doesn't
have
to be visible.
--
Duane Hookom
Microsoft Access MVP


Vsn said:
Hello all,

I possibly posted this request in the wrong news group yesterday, jet
another try:

I try to make a report where I need the fields fPersID and fPersName
printed, this goes in a textbox no problem. Now I need, in my VBA code,
the
data from the field fTestField to see what the code should do next. I
thought I could get this code like stgX = me![fTestField], this however
gives and error (2465).

I do set the record source for the report as below at the Report_Open
event.

Rsrc = "SELECT fPersID, fPersName, fTestField FROM tblPers"
Me.RecordSource = Rsrc

I would like to set Me.txtTest = to the fTestField date, which is in the
record source.

Can someone tell me how I can get access to the data fTestField without
linking this to a field/text box on the report.

Thx a lot.

Ludovic
 

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

Similar Threads


Top