tractorvix
Technical User
Hi,
I seem to have a bit of a mental block with the code below. I basically need it to check the value of a field in a query and if that value is >35 then to do one thing and if it's not then to do another.
current code is
Option Compare Database
Private Sub Command6_Click()
Dim curhours As Long
'curhours = WHAT??!!
'I need this to pull the sumwkhours value from the qrytotalweekhours where field date = me.date
'have tried
'strsql = "SELECT qryweekhours.date, qryweekhours.sumwkhours FROM qryweekhours WHERE (((qryweekhours.date)=[Forms]![Form1]![date]));"
'DoCmd.RunSQL strsql
'but no joy
If Me.hours >= 35 Then
MsgBox "Schedule will split over " & (Me.hours / 35) & " weeks"
Else
If curhours >= 35 Then
fullinput = MsgBox("Selected week is full. Would you like the scheduler to assign to available time?", vbYesNo, "Busy Week!")
If fullinput = vbYes Then
PopSchedule
MsgBox "Start date has been set to " & newstartdate
Else
MsgBox "Please select new start date"
Me.date.SetFocus
End If
Else
End If
End If
End Sub
any guidance would be great.
Thanks
TV
I seem to have a bit of a mental block with the code below. I basically need it to check the value of a field in a query and if that value is >35 then to do one thing and if it's not then to do another.
current code is
Option Compare Database
Private Sub Command6_Click()
Dim curhours As Long
'curhours = WHAT??!!
'I need this to pull the sumwkhours value from the qrytotalweekhours where field date = me.date
'have tried
'strsql = "SELECT qryweekhours.date, qryweekhours.sumwkhours FROM qryweekhours WHERE (((qryweekhours.date)=[Forms]![Form1]![date]));"
'DoCmd.RunSQL strsql
'but no joy
If Me.hours >= 35 Then
MsgBox "Schedule will split over " & (Me.hours / 35) & " weeks"
Else
If curhours >= 35 Then
fullinput = MsgBox("Selected week is full. Would you like the scheduler to assign to available time?", vbYesNo, "Busy Week!")
If fullinput = vbYes Then
PopSchedule
MsgBox "Start date has been set to " & newstartdate
Else
MsgBox "Please select new start date"
Me.date.SetFocus
End If
Else
End If
End If
End Sub
any guidance would be great.
Thanks
TV