MDE File

W

Welthey

I am trying to create an MDE file and I'm getting an error on the following
code. I'm getting a Complile Error on the following code. I'm not quite
sure where to go from here. Is the code not compatible with the MDE file.
I'm new to Access so I am not sure what is really wrong. Can some please
advise on how to proceed. Thank you.

Private Sub Days_Out_Of_Compliance_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_WorkingDays

Dim intCount As Integer

StartDate = StartDate + 3

intCount = 0
Do While StartDate <= EndDate

Select Case Weekday(StartDay)
Case Is = 1, 7
intCount -intCount (I get the compile error on this line.)
Case Is = 2, 3, 4, 5, 6
intCount = intCount + 1
End Select
StartDate = StartDate + 3
Loop
WorkingDays = intCount

Exit_WorkingDays:
Exit Function

Err_WorkingDays:
Select Case Err

Case Else
MsgBox Err.Description
Resume Exit_WorkingDays
End Select

End Function

End Sub
 
S

Stefan Hoffmann

hi Welthey,
I am trying to create an MDE file and I'm getting an error on the following
code. I'm getting a Complile Error on the following code. I'm not quite
sure where to go from here. Is the code not compatible with the MDE file.
I'm new to Access so I am not sure what is really wrong. Can some please
advise on how to proceed. Thank you.
First check whether you have set Option Explicit, it should be the first
line in the module.
Select Case Weekday(StartDay)
Case Is = 1, 7
intCount -intCount (I get the compile error on this line.)
You have to assign the value to a variable, e.g.

intCount = intCount - 123



mfG
--> stefan <--
 
B

Bob Quintal

I am trying to create an MDE file and I'm getting an error on the
following code. I'm getting a Complile Error on the following
code. I'm not quite sure where to go from here. Is the code not
compatible with the MDE file. I'm new to Access so I am not sure
what is really wrong. Can some please advise on how to proceed.
Thank you.

Private Sub Days_Out_Of_Compliance_BeforeUpdate(Cancel As Integer)
On Error GoTo Err_WorkingDays

Dim intCount As Integer

StartDate = StartDate + 3

intCount = 0
Do While StartDate <= EndDate

Select Case Weekday(StartDay)
Case Is = 1, 7
intCount -intCount (I get the compile error on this line.)
Case Is = 2, 3, 4, 5, 6
intCount = intCount + 1
End Select
StartDate = StartDate + 3
Loop
WorkingDays = intCount

Exit_WorkingDays:
Exit Function

Err_WorkingDays:
Select Case Err

Case Else
MsgBox Err.Description
Resume Exit_WorkingDays
End Select

End Function

End Sub

what are you trying to do with the line intcount - intcount?
Right now its saying subtract intcount from itself, but you are not
assigning the result to anything, which gives the compile error, or
did you mean intcount = intcount, which is a waste of computer
cycles.
Based on the rest of the code, just remove the line completely, it
is not necessary, you only need to test for saturday or sunday, and
do nothing if that is the case.
 
W

Welthey

I'm not quite sure what that means. Is that something that I need to type at
the beginning of the code? Also I ran into another error at the
Me.cboBannerLabel, I'm going to assume that since it stopped at the first one
that all the rest of them. Any ideas?

Private Sub cboBannerLabel_AfterUpdate()
Me.txtReportName = DLookup("[Report Name]",
"[tblAMUDailyRptsMatrix]", "[Banner Label]='" & Me.cboBannerLabel & "'")
Me.txtJobName = DLookup("[Job Name]", "[tblAMUDailyRptsMatrix]",
"[Banner Label]='" & Me.cboBannerLabel & "'")
Me.txtQueue = DLookup("[Queue Data Goes In]",
"[tblAMUDailyRptsMatrix]", "[Banner Label]='" & Me.cboBannerLabel & "'")
Me.txtDeliverTo = DLookup("[Deliver To]", "[tblAMUDailyRptsMatrix]",
"[Banner Label]='" & Me.cboBannerLabel & "'")
Me.txtPrimaryContact = DLookup("[Primary Contact]",
"[tblAMUDailyRptsMatrix]", "[Banner Label]='" & Me.cboBannerLabel & "'")
 
S

Stefan Hoffmann

hi Welthey,
I'm not quite sure what that means. Is that something that I need to type at
the beginning of the code?
Yes.

You may take a look at Tools/Options. There you can check
"Require Variable Declaration". When creating a new module of any type,
this will place the "Opition Explicit" at the first line if it.
Without this, any variable name, even it is a typo, will be accepted:

Dim i As Integer

i=100
i=j+1
MsgBox i

This is also a problem, when you refer to controls and rename them later.
Private Sub cboBannerLabel_AfterUpdate()
Me.txtReportName = DLookup("[Report Name]",
"[tblAMUDailyRptsMatrix]", "[Banner Label]='" & Me.cboBannerLabel & "'")
This looks fine. Place the Option Explicit into the first line of your
form module and run Debug/Compile.


mfG
--> stefan <--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top