Open report based on Asset Number in form (1 Viewer)

IannWard

Registered User.
Local time
Today, 01:40
Joined
Feb 19, 2015
Messages
30
Hi All

I have a form that I use to search and modify asset info. If I for example search for the asset 01234567, the form is populated with the current table entry for that number. Is what I want to do is add a button to the form that when clicked will run a query and then show a history report based on the number in the asset field. I have created reports before that will ask for the asset number before creating the report but I don't want it to ask, I just want it to use the number already searched for in the form.

Any help appreciated.

Iann
 

essaytee

Need a good one-liner.
Local time
Today, 12:40
Joined
Oct 20, 2008
Messages
512
Or another approach, create a query, at Criteria cell (under your Asset field) enter your form control value, like so,

[Forms]![frm_Test]![txtAssetNo]

Intellisense will make it easy for you.

Use this query as the recordsource for the report. This report can now be called from the form directly, you will not be prompted for the Asset no.
 

IannWard

Registered User.
Local time
Today, 01:40
Joined
Feb 19, 2015
Messages
30
Or another approach, create a query, at Criteria cell (under your Asset field) enter your form control value, like so,

[Forms]![frm_Test]![txtAssetNo]

Intellisense will make it easy for you.

Use this query as the recordsource for the report. This report can now be called from the form directly, you will not be prompted for the Asset no.

Many thanks for your time. That was exactly what I was looking for, just wasn't sure of the Criteria bit (still learning).

One more question though, I click my button and the report opens but it opens in a new tab, I have to close the report to get back to my original form. Is there a way to have it open in like a floating or smaller window so I can see both together?

Kind Regards
 

apr pillai

AWF VIP
Local time
Today, 07:10
Joined
Jan 20, 2005
Messages
735
Open Access Options - - >Current Database - ->under Document Window Options - - > select Overlapping Windows.

put the following code in the Report Module:

Code:
Private Sub Report_Open(Cancel As Integer)
DoCmd.Restore
End Sub
 
Last edited:

Users who are viewing this thread

Top Bottom