hi all
i have form used to run report called final ,it contains many fields
i set text boxes to set my condition's through it ,it works perfectly
but
when i thought to collect all the conditions together i failed because i am not experience enough with coding .
so i am looking for your help .
that is my codes i used in my form :
the following corrupted character is not english words ,so no problem with them at all
Private Sub cmdop999_Click() DoCmd.OpenReport "final", acViewPreview, , "[الكلمه بدون تشكيل]='" & Me.cbo981 & "'" End SubPrivate Sub cmdopsuraname_Click() DoCmd.OpenReport "final", acViewPreview, , "[sura_name]='" & Me.cbosura_name & "'" End SubPrivate Sub cmdopsurano_Click() DoCmd.OpenReport "final", acViewPreview, , "[sura_no]=" & Me.cbosura_no End Sub
Private Sub Command40_Click() DoCmd.OpenReport "final", acViewPreview, , "[root]='" & Me.Combo37 & "'" End SubPrivate Sub Command45_Click() DoCmd.OpenReport "final", acViewPreview, , "[الكلمه المشكله]='" & Me.Combo42 & "'" End Sub
and that what i am trying to do :
Private Sub Command1000_Click() DoCmd.OpenReport "final", acViewPreview, , "[الكلمه بدون تشكيل]='" & Me.cbo981 & "'" DoCmd.OpenReport "final", acViewPreview, , "[sura_name]='" & Me.cbosura_name & "'" DoCmd.OpenReport "final", acViewPreview, , "[sura_no]=" & Me.cbosura_no DoCmd.OpenReport "final", acViewPreview, , "[root]='" & Me.Combo37 & "'" DoCmd.OpenReport "final", acViewPreview, , "[الكلمه المشكله]='" & Me.Combo42 & "'" End Sub
i know that this sentence (DoCmd.OpenReport "final", acViewPreview) should be removed and put some thing like & or and or what ever code need .
i don't know exactly how to write this code
so your help will be appropriated
regards,
sherif
You should be able to do this:
DoCmd.OpenReport "final", acViewPreview, , "[الكلمه بدون تشكيل]='" & Me.cbo981 & "'" & " AND " & "[sura_name]='" & Me.cbosura_name & "'" & " AND " & "[sura_no]=" & Me.cbosura_no & " AND " & "[root]='" & Me.Combo37 & "'" & " AND " & "[الكلمه المشكله]='" & Me.Combo42 & "'"
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
so i have to put
& " AND " &
between every one ?
That part of the OpenReport function is basically the WHERE clause of a SQL statement without the WHERE keyword. So you'd set it up like you are building a SQL statement. When you want to use more than one condition in the WHERE clause, you AND them together.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
it gives message " run time error " some thing wrong ,but i don't know what
any advise ?
Run Time Error is a generic error label. I won't know unless you provide more info. What line is it on?
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
i found another way to achieve my target ,
thanks for you
It would be helpful for others who may run into the same issue if you could post your solution. This forum is read by many people, and there could be others trying to find a way to do what you did.
Is your code running too slowly?
Does your workbook or database have a bunch of duplicate pieces of data?
Have a look at this article to learn the best ways to set up your projects.
It will save both time and effort in the long run!
Dave
sure with my pleasure
i found a sample to generate the report you want easily building on amazing query
hope that help all of you
please check the attached file , and tell me if you like it
kind regards
sherif
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks