Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc,comp.databases.ms-access
external usenet poster
 
Posts: 2
Default visual basic within Access If...Then

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

  #2   Report Post  
Posted to microsoft.public.excel.misc
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
visual basic within Access If...Then arabella79 Excel Discussion (Misc queries) 0 October 5th 06 09:24 PM
Microsoft Visual Basic Error in Excel mack Excel Discussion (Misc queries) 0 August 24th 06 07:27 PM
Trust access to visual basic project in XP systems kasi Excel Discussion (Misc queries) 5 October 13th 05 01:32 PM
Linking to Visual Basic for Applications Help Files Glynn Excel Discussion (Misc queries) 0 October 8th 05 01:29 AM
Trust access to visual basic project greyed out Amit Shanker Excel Discussion (Misc queries) 2 March 5th 05 09:41 PM


All times are GMT +1. The time now is 11:21 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"