variable mismatch assistance?

  • Thread starter Thread starter Janet
  • Start date Start date
J

Janet

The onclick event has the following code performing
nicely:

DoCmd.Save
Me.Refresh
If DCount("subEventID", "qryISDNparticipantCount") = 0
Then
Me!recISDNRate = 0
Else
If Me!cboReceivables.Column(9) = "NC" Then
Me!recISDNRate = (DateDiff("n", [Forms]!
[frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1) * Me!cboReceivables.Column(5)
Else
Me!recISDNRate = (DateDiff("n", [Forms]!
[frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1) * Me!cboReceivables.Column(6)
End If
End If
If DCount("subEventID", "qryIPparticipantCount") = 0
Then
Me!recIPrate = 0
Else
Me!recIPrate = (DateDiff("n", [Forms]!
[frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1) * Me!cboReceivables.Column(7)
End If


But, this blows up and my self-research isn't getting me
anywhere. Any help?


Dim varAfterHours as single
If Time([Forms]![frmSubEvents]![subStart]) > Time
("05:00:00 PM") Then
varAfterHours = varAfterHours + (DateDiff("n",
[Forms]![frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1)
End If
Me!recAfterHrRate = varAfterHours * Me!
cboReceivables.Column(4)

Thanks so much!
 
Janet said:
The onclick event has the following code performing
nicely:

DoCmd.Save
Me.Refresh
If DCount("subEventID", "qryISDNparticipantCount") = 0
Then
Me!recISDNRate = 0
Else
If Me!cboReceivables.Column(9) = "NC" Then
Me!recISDNRate = (DateDiff("n", [Forms]!
[frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1) * Me!cboReceivables.Column(5)
Else
Me!recISDNRate = (DateDiff("n", [Forms]!
[frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1) * Me!cboReceivables.Column(6)
End If
End If
If DCount("subEventID", "qryIPparticipantCount") = 0
Then
Me!recIPrate = 0
Else
Me!recIPrate = (DateDiff("n", [Forms]!
[frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1) * Me!cboReceivables.Column(7)
End If


But, this blows up and my self-research isn't getting me
anywhere. Any help?


Dim varAfterHours as single
If Time([Forms]![frmSubEvents]![subStart]) > Time
("05:00:00 PM") Then
varAfterHours = varAfterHours + (DateDiff("n",
[Forms]![frmSubEvents]![subEnd], [Forms]![frmSubEvents]!
[subStart]) / 60 * -1)
End If
Me!recAfterHrRate = varAfterHours * Me!
cboReceivables.Column(4)

Thanks so much!

The only really obvious error is this:
If Time([Forms]![frmSubEvents]![subStart]) > Time
("05:00:00 PM") Then

The Time() function takes no arguments. Maybe it's the TimeValue
function you have in mind.
 
Dirk Goldgar said:
The only really obvious error is this:
If Time([Forms]![frmSubEvents]![subStart]) > Time
("05:00:00 PM") Then

The Time() function takes no arguments. Maybe it's the TimeValue
function you have in mind.

Or possibly CDate
 
Back
Top