Create a report from multi list query

Hopefully u can share with me any knowledge u get about ms access next time.:D
 
Hai...

i got new problem. I try to put a button (Report) to open the report at the current query. But it open all data. here i attach the db.:confused:
 

Attachments

Hai...

i got new problem. I try to put a button (Report) to open the report at the current query. But it open all data. here i attach the db.:confused:


ah, that's because the BuildFilter string ends up being " WHERE .....etc", while and open report comand doesn't need " WHERE ", it just assumes you are filtering at that argument.

so the trick is to remove the leading " WHERE " from the string.

here's the DB back with the report filtering :)
 

Attachments

Thanks. it seem so easy. but difficult for me to understand.

can u teach me more about the code?


Dim strWhere As String (what is code for?)

strWhere = BuildFilter

If Left(strWhere, 7) = " WHERE " Then
strWhere = Right(strWhere, Len(strWhere) - 7) (why there is a number.)
End If

hopefully u can become my teacher.:D
 
Dim strWhere As String (what is code for?)

this is a declaration to access what "strWhere" is (A String = a length of text). kind of like telling access what you are calling the 'string' that you want to use.

If Left(strWhere, 7) = " WHERE " Then

this piece of code first asks whether the first 7 characters from the left in the string 'strWhere' are these: " WHERE ".

(which is "[space]WHERE[space]" = 7 characters) space counts as a character, there's one space on either side of "WHERE", making 2 and then WHERE has 5 characters itself. together, that's 7.

If there is, THEN it goes on to the next line.

strWhere = Right(strWhere, Len(strWhere) - 7) (why there is a number.)

this is where you change the string 'strWhere' to the new string you want (a string without the " WHERE " in front), so you chop off the first seven characters. You do this by selecting the entire length (Len) of the string from the right, minus the first 7 (which are " WHERE ")


hopefully u can become my teacher.:D

i really hate to dissappoint you but i'm WAAAAY too busy to become a private tutor right now. there are lots of people on this forum who can help you with the various problems you may encounter. i happened to be able to help you with this one, but many others will be beyond my expertise.

however, it's refreshing to find someone who actually wants to LEARN this stuff rather than just get the answers to their problems. ;)
 
:c

i really hate to dissappoint you but i'm WAAAAY too busy to become a private tutor right now. there are lots of people on this forum who can help you with the various problems you may encounter. i happened to be able to help you with this one, but many others will be beyond my expertise.

however, it's refreshing to find someone who actually wants to LEARN this stuff rather than just get the answers to their problems. ;)

:( NEVER MIND I UNDERSTAND. anyway thank again 4 ur help.
u done have 2 be my private tutor (i know u busy). u just give the answer when i ask that's all. ok!! :cool:
 
Re: :c

:( NEVER MIND I UNDERSTAND. anyway thank again 4 ur help.
u done have 2 be my private tutor (i know u busy). u just give the answer when i ask that's all. ok!! :cool:

i AM here to help :)
 

Users who are viewing this thread

Back
Top Bottom