Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 8th, 2003, 10:04 PM
nitrous nitrous is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 nitrous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Function question

Write a function called getFed which returns the average amount of fed used per day over a requested minimum time frame for a particular location. The time frame is the period between the latest two drop events that have recorded a true DropFull.

Pass two arguments (Id and TimeFram) to the function. If no valid time frame exists, return a 0. TimeFrame is expressed in days or fractions of a day.

anybody??

Reply With Quote
  #2  
Old October 8th, 2003, 10:50 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
Before you get smashed by the moderators.. let me make a suggestion. Try posting the code you are working on and asking for suggestions on it.. it's not usually a good idea to just ask for code to be written for you.
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #3  
Old October 8th, 2003, 10:51 PM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
Just joking moderators... dont smash me now

Reply With Quote
  #4  
Old October 8th, 2003, 11:30 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
Funny question!FED??Every time??Joking question!?

Reply With Quote
  #5  
Old October 9th, 2003, 04:03 PM
nitrous nitrous is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Oct 2003
Posts: 3 nitrous User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
okay sorry about that guys..here is what i have so far but the total just doesn't calculate...anyways anybody see an error..and i dont know if this is possible but i need an answer within the hour...hope somebody can help me
Code:
Private Function GetFeedDisappearance(x As Integer, Y As Integer) As Integer

GetFeedDisappearance = x / Y
'Takes x (total feed used) and devides it by X(total days)

End Function

Private Function isDateBetween(tmpDate As String, DateStart As String, DateEnd As String, Optional Exclusive As Boolean = True) As Boolean
If (txtstart = "mm/dd/yy") Or (txtend = "mm/dd/yy") Then
MsgBox "Erorr, Invalid date Format"
Else
    Dim tmpVal As Integer
    If Exclusive Then tmpVal = 1
    If Not Exclusive Then tmpVal = 0
    isDateBetween = True
    Debug.Print "DateStart - tmpDate = " & DateDiff("d", DateStart, tmpDate)
    If DateDiff("d", DateStart, tmpDate) < tmpVal Then
           isDateBetween = False
    ElseIf DateDiff("d", tmpDate, DateEnd) < tmpVal Then
           isDateBetween = False
    End If
End If
End Function


Private Sub cmdCheck_Click()
total = 0
If (cmbID = "") Or (txtstart = "mm/dd/yy") Or (txtend = "mm/dd/yy") Then
MsgBox "Error, Invalid input."
Else


If (cmbID = txtID) And (txtDropID = 1) Then
        Dim x As String
        x = Trim(cmbID.List(cmbID.ListIndex))
        cnMain.Recordset.Filter = "DropID= '" & x & " '"
        
        
        If isDateBetween(txttemp, txtstart, txtend) And (txtfull = 1) Then
        total = total + txtTotalByWeight
        Else
            With cnMain.Recordset
    .MoveNext
    End With
        End If
    End If


End If

txtAverage = total
End Sub
*edit: added code tags

Last edited by Onslaught : October 10th, 2003 at 08:46 AM.

Reply With Quote
  #6  
Old October 9th, 2003, 07:49 PM
cleverpig cleverpig is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jul 2003
Posts: 1,152 cleverpig User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
Send a message via MSN to cleverpig
What's txtTotalByWeight??txtAverage??U don't declare these variables...

Reply With Quote
  #7  
Old October 10th, 2003, 07:44 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
well... I don't know if this has anything to do with it, but you have an open if statement in isbetweendate

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Function question


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway