Compile error: Method or data member not found (Error 461)

mjdemaris,

Hi I am back again, sorry late reply to you. In google, I have this program of Allen Browne about locking bound controls, it did the trick of locking the forms upon the opening of form, only the problem was it also included locking my subform in TabCtl. Still looking to fix this problem. Thanks a lot for your visit.
 
mjdemaris,

As you requested, here is the code of my program I am developing. If you will notice, I have changed the problematic field names mentioned above previous message into : [SEQUENCE OF EVENTS], [STATUS NORMALIZED], [STATUS BEING NORMALIZED], [STATUS UNDER SHUTDOWN], [OTHERS 2], [NAME ORIGINATOR], and [DATE PREPARED]. About Allen Browne's locking bound controls (not included in this code), I am still working to simply include in the lock button these mentioned problematic field names upon the opening of form. Only this, I need to fix from this code. I posted below brief codes where the problematic field names are located. Thank you.
_________________________________________________________________

Option Compare Database

Private Sub Combo62_AfterUpdate()

End Sub

Private Sub Command4_Click()
On Error GoTo Err_Command4_Click


DoCmd.GoToRecord , , acNewRec

Exit_Command4_Click:
Exit Sub

Err_Command4_Click:
MsgBox Err.Description
Resume Exit_Command4_Click

End Sub
Private Sub Combo5_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me!Recordset.Clone
rs.FindFirst "[INCIDENTREPORTSEQNO] = " & Str(Nz(Me![Combo5], 0))
If Not rs.EOF Then Me.Bookmark = rs.Bookmark

End Sub


Private Sub Command302_Click()
Command76.Enabled = False
INCIDENTREPORTSEQNO.Locked = True
[DATE].Locked = True
[CATEGORY].Locked = True
[AREA].Locked = True
[UNIT NO].Locked = True
[EQUIPMENT].Locked = True
[TIME].Locked = True
[TRIP].Locked = True
[FIRE].Locked = True
[DUMP].Locked = True
[RUPTURE].Locked = True
[EXPLOSION].Locked = True
[OTHERS 1].Locked = True
[POWER LOSS].Locked = True
[WATER LOSS].Locked = True
[PROPERTY DAMAGE].Locked = True
[PERSONAL INJURY].Locked = True
[OTHER CAUSE].Locked = True
[POWER GEN PRIOR TO INCIDENT].Locked = True
[POWER GEN AFTER THE INCIDENT].Locked = True
[WATER PROD PRIOR TO THE INCIDENT].Locked = True
[WATER PROD AFTER THE INCIDENT].Locked = True
[SEQUENCE OF EVENTS].Locked = True
[STATUS NORMALIZED].Locked = True
[STATUS BEING NORMALIZED].Locked = True
[STATUS UNDER SHUTDOWN].Locked = True
[OTHERS 2].Locked = True
[NAME ORIGINATOR].Locked = True
[DATE PREPARED].Locked = True

MsgBox ("All Data has been locked .... ")

End Sub

Private Sub Command303_Click()
' ask for password
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
Exit Sub
End If


INCIDENTREPORTSEQNO.Locked = False
[DATE].Locked = False
[CATEGORY].Locked = False
[AREA].Locked = False
[UNIT NO].Locked = False
[EQUIPMENT].Locked = False
[TIME].Locked = False
[TRIP].Locked = False
[FIRE].Locked = False
[DUMP].Locked = False
[RUPTURE].Locked = False
[EXPLOSION].Locked = False
[OTHERS 1].Locked = False
[POWER LOSS].Locked = False
[WATER LOSS].Locked = False
[PROPERTY DAMAGE].Locked = False
[PERSONAL INJURY].Locked = False
[OTHER CAUSE].Locked = False
[POWER GEN PRIOR TO INCIDENT].Locked = False
[POWER GEN AFTER THE INCIDENT].Locked = False
[WATER PROD PRIOR TO THE INCIDENT].Locked = False
[WATER PROD AFTER THE INCIDENT].Locked = False
[SEQUENCE OF EVENTS].Locked = False
[STATUS NORMALIZED].Locked = False
[STATUS BEING NORMALIZED].Locked = False
[STATUS UNDER SHUTDOWN].Locked = False
[OTHERS 2].Locked = False
[NAME ORIGINATOR].Locked = False
[DATE PREPARED].Locked = False


Command76.Enabled = True


' all field list you want to locked

End Sub

Private Sub Command605_Click()
On Error GoTo Err_Command605_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "frmHelpDeskTickets"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Private Sub Command76_Click()
On Error GoTo Err_Command76_Click

DoCmd.GoToRecord , , acNewRec

Dim vLastY As Variant
Dim iNext As Integer
vLastY = DMax("[INCIDENTREPORTSEQNO]", "[INCIDENT REPORT]", "[INCIDENTREPORTSEQNO] LIKE '" & Format(DATE, "yy\*\'"))
If IsNull(vLastY) Then
iNext = 1
Else
iNext = Val(Mid(vLastY, 7, 4)) + 1
End If
Me![INCIDENTREPORTSEQNO] = Format(DATE, "yy-mm") & "-" & Format(iNext, "000")


Exit_Command76_Click:
Exit Sub

Err_Command76_Click:
MsgBox Err.Description
Resume Exit_Command76_Click

End Sub
Private Sub Command79_Click()
On Error GoTo Err_Command79_Click


Screen.PreviousControl.SetFocus
DoCmd.DoMenuItem acFormBar, acEditMenu, 10, , acMenuVer70

Exit_Command79_Click:
Exit Sub

Err_Command79_Click:
MsgBox Err.Description
Resume Exit_Command79_Click

End Sub
Private Sub Combo80_AfterUpdate()
' Find the record that matches the control.
Dim rs As Object

Set rs = Me.Recordset.Clone
rs.FindFirst "[INCIDENTREPORTSEQNO] = '" & Me![Combo80] & "'"
If Not rs.EOF Then Me.Bookmark = rs.Bookmark
End Sub

Private Sub Print_Incident_Main_Report_Click()
On Error GoTo Err_Print_Incident_Main_Report_Click

Dim stDocName As String

stDocName = "IncidentMainReport"
DoCmd.OpenReport stDocName, acNormal

Exit_Print_Incident_Main_Report_Click:
Exit Sub

Err_Print_Incident_Main_Report_Click:
MsgBox Err.Description
Resume Exit_Print_Incident_Main_Report_Click

End Sub
Private Sub Command95_Click()
On Error GoTo Err_Command95_Click

Dim stDocName As String

stDocName = "MaintenanceReport"
DoCmd.OpenReport stDocName, acNormal

Exit_Command95_Click:
Exit Sub

Err_Command95_Click:
MsgBox Err.Description
Resume Exit_Command95_Click

End Sub
Private Sub Command97_Click()
On Error GoTo Err_Command97_Click

Dim stDocName As String

stDocName = "OperationReport"
DoCmd.OpenReport stDocName, acNormal

Exit_Command97_Click:
Exit Sub

Err_Command97_Click:
MsgBox Err.Description
Resume Exit_Command97_Click

End Sub
Private Sub Command99_Click()
On Error GoTo Err_Command99_Click

Dim stDocName As String

stDocName = "IncidentMainReport"
DoCmd.OpenReport stDocName, acPreview

Exit_Command99_Click:
Exit Sub

Err_Command99_Click:
MsgBox Err.Description
Resume Exit_Command99_Click

End Sub
Private Sub Command100_Click()
On Error GoTo Err_Command100_Click

Dim stDocName As String

stDocName = "IncidentMainReport"
DoCmd.OpenReport stDocName, acPreview

Exit_Command100_Click:
Exit Sub

Err_Command100_Click:
MsgBox Err.Description
Resume Exit_Command100_Click

End Sub

Private Sub SCE_Click()
End Sub

Private Sub TabCtl245_Change()


Dim strInput As String
Dim ctl As Control

If TabCtl245.Value = 0 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If


If TabCtl245.Value = 1 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 2 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 3 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If


If TabCtl245.Value = 4 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 5 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 6 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 7 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 8 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 9 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 10 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 11 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 12 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 13 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

If TabCtl245.Value = 14 Then
strInput = InputBox(" Please Enter Password ", _
" Restricted area ")
If strInput = "" Or strInput = Empty Then
MsgBox " Please Enter Password ", , "Required Data"
TabCtl245.Pages.Item(0).SetFocus
Exit Sub
End If
If strInput = "123" Then
Else
MsgBox (" You are not athorized ")
TabCtl245.Pages.Item(0).SetFocus

Exit Sub
End If
End If

End Sub

Private Sub Text239_AfterUpdate()
INCIDENTREPORTSEQNO.SetFocus
DoCmd.FindRecord Text239.Value
Text239.Value = ""
Text239.SetFocus



End Sub

Private Sub Command244_Click()
On Error GoTo Err_Command244_Click


DoCmd.RunCommand acCmdUndo
DoCmd.GoToRecord , , acLast

Exit_Command244_Click:
Exit Sub

Err_Command244_Click:
'MsgBox Err.Description
Resume Exit_Command244_Click

End Sub
Private Sub Command253_Click()
On Error GoTo Err_Command253_Click


DoCmd.GoToRecord , , acFirst

Exit_Command253_Click:
Exit Sub

Err_Command253_Click:
MsgBox Err.Description
Resume Exit_Command253_Click

End Sub
Private Sub Command254_Click()
On Error GoTo Err_Command254_Click


DoCmd.GoToRecord , , acPrevious

Exit_Command254_Click:
Exit Sub

Err_Command254_Click:

DoCmd.GoToRecord , , acFirst
'MsgBox Err.Description
Resume Exit_Command254_Click

End Sub
Private Sub Command255_Click()
On Error GoTo Err_Command255_Click


DoCmd.GoToRecord , , acNext

Exit_Command255_Click:
Exit Sub

Err_Command255_Click:

DoCmd.GoToRecord , , acLast

'MsgBox Err.Description
Resume Exit_Command255_Click

End Sub
Private Sub Command256_Click()
On Error GoTo Err_Command256_Click


DoCmd.GoToRecord , , acLast

Exit_Command256_Click:
Exit Sub

Err_Command256_Click:
MsgBox Err.Description
Resume Exit_Command256_Click

End Sub
Private Sub Command286_Click()
On Error GoTo Err_Command286_Click

Dim stDocName As String

stDocName = "E-mail Tracking"
DoCmd.RunMacro stDocName
 
Your data and code are seriously badly organised. Anytime you use repeating code over and over again it point's either to code that should be in a function or module that is called, or data that isn't stored properly.

In your case it is both. When you have field names that indicate a actual object type you normally should be storing those in a separate table.

So fields called FIRE , DUMP, RUPTURE , EXPLOSION, OTHERS 1, POWER LOSS, WATER LOSS etc. etc. should be stored as a incident type in a incident table related to your main Data. At the moment if another type of incident arrives you haven't thought of occurs , lets call it ALIEN INVASION, you would have to redesign your form and code and every report to accommodate the extra incident type. As you can imagine this is fundamentally wrong.

Secondly your code - you should at the very least put the Passworrd code in a module and call it, however as the same password allows access to any of the tab controls why not just store the result of the first password entry and if it's not true then don't let the user in.

Finally we can't see your form control names so have no idea why the code to lock the controls doesn't work, but have already suggest a more efficient way of doing what you are trying to achieve.

But read up about data normalisation first - you need to fix that before anything else.
 
Minty,

These repetitive calling codes here are caused by trial and error that I experimented to apply. I removed some codes here because the chat room limits character to post, so I just put here the codes that have errors. Field names are stored in one table and I tested it all by filling the form and it generates the report successfully. Those password assigned will be put into change later as the program runs perfectly, sorry if the form control is not there as there is no more space for the chat room to accommodate it. I will just clean it up and share my thoughts again. Thank you for your visit
 
If you post your code in code tags, (look for the # symbol in the advanced reply box) you can post formatted code that is easier to read and longer in text.

And surely your field names are set in the table design not stored in another table?
 
put

Option Explicit at the top, and then try compiling. It might be a problem with undeclared variable
 
gemma-the-husky,

I've tried typing Option Explicit at the top of the code. This is the error I received upon compiling: Type mismatch: pointing to (hLib) of below code. I have already deleted from my code the MouseWheelOff to stop receiving previous error: missing .dll file.

Public Function MouseWheelON() As Boolean
MouseWheelON = StartMouseWheel(Application.hWndAccessApp)
If hLib <> 0 Then
hLib = FreeLibrary(hLib)
End If
End Function
 
Minty,

All mentioned problematic field names are declared in the table: Incident Report. Thanks for the visit.
 
comment out the mousewheel code within the sub, and compile again. you need to get all compile errors sorted. then you can fix the mousewheel code.

keep the mousewheel declaration

Public Function MouseWheelON() As Boolean
' MouseWheelON = StartMouseWheel(Application.hWndAccessApp)
' If hLib <> 0 Then
' hLib = FreeLibrary(hLib)
' End If
End Function
 
Why don't you post your complete database in a zip file? We are going in circles here trying to guess what the root problem is.

We need to SEE the objects, relationships, SQL, events, etc.

And, while developing or experimenting, you really should rename your controls. Much less confusion as well.

Can you post your complete database, not just some code?
 
gemma-the-husky,

I have already fix the problem on MouseWheel by removing the code in my program because of version conflict from access97 to access2000 .dll file is missing when the mousewheel code is called to run. Thanks for checking.
 
Minty,

I have found a way to separate the main form from those TabCtls which are being locked upon calling the Lock Bound Controls of Allen Brown's code. I just put Tabctls into another form and put the cmdLock on that form to serve as the lock/unlock for tabctls. I put also a separate enable/lock button in the main form, the reason why I need to this is upon running Allen Brown's Locking bound controls, it locked everything including those TabCtls while my original plan is to lock only the main form. In putting my TabCtls into another form and putting the cmdLock code, the locking function is running separately to both forms. Thanks a lot for your help.
 

Users who are viewing this thread

Back
Top Bottom