J
Judi
Hello, I'm using Access 2003 and Windows XP.
I have a database that is being used to keep track of and schedule quotes. I
am trying to have a message pop up for a user if they schedule more than 3
quotes to be due on the same day.
What I have so far is a query that pulls up how many quotes are due for that
day already. I want to assign this number to a variable and then put the
variable in a before_update event for the control on my form.
I feel like I have the right logic, but an improper knowledge of the
language necessary to accomplish this.
I also want the user to be able to either go back and change the date or
keep the selection and move to the next control on the form.
Here is my pig-latin version of the before_update event:
Private Sub SchdDate_BeforeUpdate(Cancel As Integer)
Dim IntX As Integer
DoCmd.OpenQuery "qryTooMany", , acReadOnly
IntX = ("CountofID" from "qryTooMany") <===I don't know how to do
this part at all
If IntX >= 3 Then
If MsgBox("You already have " & IntX _
& "quotes scheduled for that date." _
& "Do you want to reschedule this quote?", vbYesNo + vbDefaultButton2) =
vbYes Then
Cancel = True
Me!SchdDate.Undo
Me!SchdDate.SetFocus
End If
Me!DateQuoted.SetFocus 'Where Date quoted is the next control on the form
End If
End Sub
----------------------------------------------------------
I know this is off in more than one way, but like I said, I feel like I'm on
the right lines with it... I also want to close the query when it's done
feeding the integer to the if statement... maybe after the msgbox is
closed...?
If anyone can help me, I would very much appreciate it!!
Thanks, Judi <><
I have a database that is being used to keep track of and schedule quotes. I
am trying to have a message pop up for a user if they schedule more than 3
quotes to be due on the same day.
What I have so far is a query that pulls up how many quotes are due for that
day already. I want to assign this number to a variable and then put the
variable in a before_update event for the control on my form.
I feel like I have the right logic, but an improper knowledge of the
language necessary to accomplish this.
I also want the user to be able to either go back and change the date or
keep the selection and move to the next control on the form.
Here is my pig-latin version of the before_update event:
Private Sub SchdDate_BeforeUpdate(Cancel As Integer)
Dim IntX As Integer
DoCmd.OpenQuery "qryTooMany", , acReadOnly
IntX = ("CountofID" from "qryTooMany") <===I don't know how to do
this part at all
If IntX >= 3 Then
If MsgBox("You already have " & IntX _
& "quotes scheduled for that date." _
& "Do you want to reschedule this quote?", vbYesNo + vbDefaultButton2) =
vbYes Then
Cancel = True
Me!SchdDate.Undo
Me!SchdDate.SetFocus
End If
Me!DateQuoted.SetFocus 'Where Date quoted is the next control on the form
End If
End Sub
----------------------------------------------------------
I know this is off in more than one way, but like I said, I feel like I'm on
the right lines with it... I also want to close the query when it's done
feeding the integer to the if statement... maybe after the msgbox is
closed...?
If anyone can help me, I would very much appreciate it!!
Thanks, Judi <><