Why won' this work??????

dcarr

Trainee Database Analyst
Local time
Today, 06:41
Joined
Jun 19, 2002
Messages
112
Hi guys,

I have created a module as shown below, which was initially a macro. The syntax is as follows; I cannot seem to get the text box on the form frmbps to display the text. It returns errors regarding accessing forms, text box enabled, etc. Any ideas?

Option Compare Database
Option Explicit

'------------------------------------------------------------
' mcr_WklySrcWirrl_11_12
'
'------------------------------------------------------------
Function mcr_WklySrcWirrl_11_12()
On Error GoTo mcr_WklySrcWirrl_11_12_Err

' Dim frmbps As Form

Dim mydb As Database
Dim WEEKNO As TableDef
Dim weeknum As Integer


Set mydb = DBEngine.Workspaces(0).Databases(0)
Dim WeekNumber As Recordset
DoCmd.RunMacro "mcr_Warnings Off"
'DoCmd.OpenQuery "q_Calculate week number", acViewNormal, acReadOnly
Set WeekNumber = mydb.OpenRecordset("WeekNo")
WeekNumber.MoveFirst
With WeekNumber
weeknum = !Week
End With

Form_frmBPS.Text5.Enabled = True
Form_frmBPS.Text5.SetFocus
Form_frmBPS.Text5.text = "Deleting ADVERTTY_TEMP - "
' Weekly Report for Wirral
Beep
MsgBox "Please run the Weekly Source Report for Wirral (W)", vbInformation, "Weekly Source Report for Wirral"
' Run repsourcevolrevbycatbyweek for Wirral
DoCmd.OpenReport "repsourcevolrevbycatbyweek", acPreview, "", ""
' Close report
DoCmd.Close acReport, "repsourcevolrevbycatbyweek"
' Output to RTF file
DoCmd.OutputTo acReport, "repsourcevolrevbycatbyweek", "RichTextFormat(*.rtf)", "u:\adv_reps\ops\wsW" & weeknum & ".rtf", False, ""
' frmbps.Text5.text = frmbps.Text5.text & Chr$(10) & Chr$(13) & "Completed OK"

mcr_WklySrcWirrl_11_12_Exit:
Exit Function

mcr_WklySrcWirrl_11_12_Err:
MsgBox Error$
Resume mcr_WklySrcWirrl_11_12_Exit

End Function
 

Users who are viewing this thread

Back
Top Bottom