View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave F Dave F is offline
external usenet poster
 
Posts: 2,574
Default visual basic within Access If...Then

Hi, this is an MS Excel newsgroup. Your question is better asked in a
newsgroup devoted to MS Access....

Dave
--
Brevity is the soul of wit.


"arabella79" wrote:

I have a form that's based on a query. I'm trying to make the form
only accept hours worked if there is a pay rate already entered in
another form. If not the form will return a message box notifiying the
user that there is no corresponding pay rate for the hours entered,
then return the fields to null values. The problem is that my code
only works for the A rate and not for the C rate. I think my structure
or my thinking about how to do this wrong. Any help you can provide is
appreciated. Below is the code that I have so far:

Private Sub Form_AfterUpdate()
If ACheck = "bad" Then
MsgBox "You must first enter an A rate in the employee's edit form
before entering hours worked"
Me.asmonday = Null
Me.aomonday = Null
Me.admonday = Null
Me.astuesday = Null
Me.aotuesday = Null
Me.adtuesday = Null
Me.aswednesday = Null
Me.aowednesday = Null
Me.adwednesday = Null
Me.asthursday = Null
Me.aothursday = Null
Me.adthursday = Null
Me.asfriday = Null
Me.aofriday = Null
Me.adfriday = Null
Me.assaturday = Null
Me.aosaturday = Null
Me.adsaturday = Null
Me.assunday = Null
Me.aosunday = Null
Me.adsunday = Null
Me.asx = Null
Me.aox = Null
Me.adx = Null
End If
If CCheck = "bad" Then
MsgBox "You must first enter a C rate in the employee's edit form
before entering hours worked"
Me.csmonday = Null
Me.comonday = Null
Me.cdmonday = Null
Me.cstuesday = Null
Me.cotuesday = Null
Me.cdtuesday = Null
Me.cswednesday = Null
Me.cowednesday = Null
Me.cdwednesday = Null
Me.csthursday = Null
Me.cothursday = Null
Me.cdthursday = Null
Me.csfriday = Null
Me.cofriday = Null
Me.cdfriday = Null
Me.cssaturday = Null
Me.cosaturday = Null
Me.cdsaturday = Null
Me.cssunday = Null
Me.cosunday = Null
Me.cdsunday = Null
Me.csx = Null
Me.cox = Null
Me.cdx = Null
End If
End Sub