A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Excel and filter



 
 
Thread Tools Display Modes
  #1  
Old July 7th, 2008, 02:11 PM posted to microsoft.public.access.queries
Ticotion
external usenet poster
 
Posts: 56
Default Excel and filter

Hi

I have a problem regarding transfering data from a query to excel. The
problem is that I need it to be filtered before transfering so it is only the
requested data that are being transferred.

At the moment the users have a form where they can choose to open an report
or a data report. But they should also have the possibility to open a query
based on the selected inputs.

I use the following code:

Private Sub commandobutten20_Click()

If Me.Afkrydsningsfelt25 = -1 Then

DoCmd.OpenReport "Rpt_AfdelingOEEgraf", acPreview, , "[Yearnb] =" &
Me.Kombinationsboks7 & " And [weeknb] = " & Me.Kombinationsboks5 & " And
[Yearnb] = " & Me.Kombinationsboks9 & " And [Weeknb] = " &
Me.Kombinationsboks11 & " And [Dpt] = """ & Me.Kombinationsboks16 & """", ,
acWindowNormal

Else

DoCmd.OpenReport "Rpt_AfdelingOEE", acPreview, , "[Year] =" &
Me.Kombinationsboks7 & " And [Week] = " & Me.Kombinationsboks5 & " And
[Year] = " & Me.Kombinationsboks9 & " And [Week] = " &
Me.Kombinationsboks11 & " And [Dpt] = """ & Me.Kombinationsboks16 & """", ,
acWindowNormal

End If

End Sub


Thanks for your help

Ticotion






  #2  
Old July 7th, 2008, 04:05 PM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 744
Default Excel and filter

On Jul 7, 8:11*am, Ticotion
wrote:
Hi

I have a problem regarding transfering data from a query to excel. The
problem is that I need it to be filtered before transfering so it is only the
requested data that are being transferred.

At the moment the users have a form where they can choose to open an report
or a data report. But they should also have the possibility to open a query
based on the selected inputs.

I use the following code:

Private Sub commandobutten20_Click()

* * If Me.Afkrydsningsfelt25 = -1 Then

* * * * DoCmd.OpenReport "Rpt_AfdelingOEEgraf", acPreview, , "[Yearnb] =" &
Me.Kombinationsboks7 & " And [weeknb] = " & Me.Kombinationsboks5 & " And
[Yearnb] = " & Me.Kombinationsboks9 & " And [Weeknb] = " &
Me.Kombinationsboks11 & " And [Dpt] = """ & Me.Kombinationsboks16 & """", ,
acWindowNormal

* * Else

* * * * DoCmd.OpenReport "Rpt_AfdelingOEE", acPreview, , "[Year] =" &
Me.Kombinationsboks7 & " And [Week] = " & Me.Kombinationsboks5 & " And
[Year] = " & Me.Kombinationsboks9 & " And [Week] = " &
Me.Kombinationsboks11 & " And [Dpt] = """ & Me.Kombinationsboks16 & """", ,
acWindowNormal

* * End If

End Sub

Thanks for your help

Ticotion


So open another query/recordset based on the first one with an
additional filter and then pass that to Excel.
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:09 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.