Computing.Net > Forums > Database > Help my code! ):

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Help my code! ):

Reply to Message Icon

Name: Eliza1234
Date: March 16, 2009 at 17:30:10 Pacific
OS: Windows XP
Subcategory: Non-specific SQL code
Comment:

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




Sponsored Link
Ads by Google

Response Number 1
Name: Rayburn
Date: March 16, 2009 at 17:36:33 Pacific
Reply:

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


0

Response Number 2
Name: Eliza1234
Date: March 16, 2009 at 18:04:00 Pacific
Reply:

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. )':


0

Response Number 3
Name: Rayburn
Date: March 16, 2009 at 19:03:02 Pacific
Reply:

What exactly is the problem?

WinSimple Software


0

Response Number 4
Name: Eliza1234
Date: March 16, 2009 at 20:19:29 Pacific
Reply:

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.


0

Sponsored Link
Ads by Google
Reply to Message Icon

Related Posts

See More







Post Locked

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


Go to Database Forum Home


Sponsored links

Ads by Google


Results for: Help my code! ):

Removal of duplicate rows www.computing.net/answers/dbase/removal-of-duplicate-rows-/395.html

PHP / MySQL Problem www.computing.net/answers/dbase/php-mysql-problem/274.html

Access - DCount/Report Problem www.computing.net/answers/dbase/access-dcountreport-problem/139.html