Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
My project going to due soon and i still can't find the error. ): This is a VBA coding in my database Microsoft Excess. )::= Please HELP!! i can't failll..
rivate Sub Command10_Click()
'initalise variable
'categorise FormSelection into variable choiceDim choice As String
If (FormSelection.Value = "Vendor") Then
choice = "A"
ElseIf (FormSelection.Value = "Inhouse") Then
choice = "B"
ElseIf (FormSelection.Value = "Japan") Then
choice = "C"
End IfOn Error GoTo Err_Command10_Click
Dim stDocName As String
stDocName = "ProductRpt"
'>> Total of 4 combinations <<
'Category Name = view all Form Selection = view all
If (CateName.Value = "View All" And FormSelection.Value = "View All") Then
DoCmd.OpenReport stDocName, acPreview
'Category Name = view all Form Selection != view all
ElseIf (CateName.Value = "View All" And FormSelection.Value <> "View All") Then
DoCmd.OpenReport stDocName, acPreview, , "FormSelection = " & choice
'Category Name != view all Form Selection = view all
ElseIf (CateName.Value <> "View All" And FormSelection.Value = "View All") Then
'Category Name! = view all Form Selection != view all
DoCmd.OpenReport stDocName, acPreview, , "CateName =" & CateName.Value
Else
'rest is team and criteria
DoCmd.OpenReport stDocName, acPreview, , "CateName = '" & CateName.Value & _
"' and FormSelection = " & choice
End If
Exit_Command10_Click:
Exit SubErr_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click
End SubPrivate Sub FormSelection_AfterUpdate()
'not one of the choice in DDL
'not view not outstanding not completed
If (FormSelection.Value = "View all") Then
ElseIf (FormSelection.Value = "Vendor") Then
ElseIf (FormSelection.Value = "Inhouse") Then
ElseIf (FormSelection.Value = "Japan") Then
Else
FormSelection.Value = "View all"
End If
End Sub

If we do your homework for you, then you don't deserve the grade. How are you going to know how to debug if you don't figure it out yourself until you get it?

I've read up alot of books of mastering microsoft 2003 from Alison Balter, Virgina Andersen and also Helen Feddema. I go along the coding that Helen feddema had given and sort out all the coding myself as given to you just now.
I been trying to figure out what went wrong with these codings since last week and 've asked friends and my dad(a programmer as well which he says it is too simple, asked me to think) bbut i just can't solve it. ): Please help. I want to really score in this module. )':

When i run the form, it can work provided that 2 combo box variable is View All. When i input a different variable in the drop down list, it doesn't show the choose variable data, instead, it show nothing.
I try debugging it and felt that the problem lies in 'CateName' as when i input CateName variable as View All, and change the FormSelection, it gives me what i want. But if i change the CateName variable and FormSelection as View All, it shows all blank. I change the coding a numerous time using different method and it just turns out to have error or not working at all.

![]() |
![]() |
![]() |

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |