Help my code! ):

March 16, 2009 at 17:30:10
Specs: Windows XP
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 choice

Dim 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 If

On 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 Sub

Err_Command10_Click:
MsgBox Err.Description
Resume Exit_Command10_Click

End Sub

Private 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



See More: Help my code! ):

Report •


#1
March 16, 2009 at 17:36:33
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?

WinSimple Software


Report •

#2
March 16, 2009 at 18:04:00
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. )':

Report •

#3
March 16, 2009 at 19:03:02
What exactly is the problem?

WinSimple Software


Report •

Related Solutions

#4
March 16, 2009 at 20:19:29
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.


Report •


Ask Question