Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I desperately need help regarding Record Source

Status
Not open for further replies.

IcePak

Technical User
Nov 7, 2001
23
0
0
US
Hi everyone,

I'm a standstill on this database at work. I can't go any further until I find out a way to do this.

I have a query thats finds one record (row) from a main table. The row is then displayed in a report. In this report I have a subreport. I want the subreport to have its record source be dependent on one cell of the previously queried (and report-displayed) row. This is necessary because there are 5 (smaller) tables that are applicable to different records in the main table. There is a field in the main table that says which of these 5 smaller tables is applicable to each record (row).

To give an example in case I'm not clear,

Field1 Field2 Field2
w1 blah blah1 Table1
w2 blah blah2 Table7

I just want information from the corresponding table to be the record source for my subreport.

ANYONE who knows how to do this or an alternative PLEASE PLEASE let me know

thanks
mike
 
Hey, IcePak, why a new thread? Not the same issue?

What about this idea:

If you know in the form that launches your report the name of the Table, you could try to set the value of the RecordSource attribute.
Try to set the value in the Open event procedure of the subreport:

Me.RecordSource=[Forms]![Test].[VARIABLE]
 
Hey Lozere,
sorry about that. thanks again for your reply. it's the same issue, just explained more clearly. I probably shouldn't have made a new thread.

Anyway, I tried that before. Now, I'm generally new at this, especially when it comes to coding and the Event tab. I opened the properties of my subreport, went to the tab that said Event, and copied and pasted that line directly into the OnOpen text area. I'm not sure if thats the way to do it, or if i need an "=" or some other form of code that I'm unaware of.

It didn't work though, it gave me an error saying that it couldn't find the MACRO named "Me.RecordSource=[Forms]![Test].Variable".

Maybe I did something wrong.

I'm really getting desperate here.
 
Hi,

What Lozere meant was for you to go to the Event tab of the SubReport, and click just to the right of the field, there is a button with three decimal points on it (e.g. "..."). This will bring up another window with three options:

"Macro Builder"
"Event "Builder"
"Code Builder"

Select "Code Builder"

This brings up another form that's just about all white. With the lines:

"Private Sub Form_Open()"
and
"End Sub"

Paste Lozere's code between these two lines and save and close the white screen (VB Editor).

Now try your form...

Hope this helps,

Kyle
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top