Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access Error Message

Status
Not open for further replies.

herd

Technical User
Jun 23, 2003
46
US
In my form, when I open it, I get the following messages.

The expression On Load you entered as the event property setting produced the following error: A problem occured while Microsoft Access was communicating with the OLE server or ActiveX Control.

Also happen On Click, and once I'm in the form and try to navigate or print button I keep getting the same message............What did I do wrong, I've been making form for years?


Thanks Gary
 
Hi,
Post your code here. Also make sure there is no double entry of your code like:...

Private Sub cmdButton_Click()
Private Sub cmdButton_Click()

...code here....

End Sub
End Sub
regards

Zameer Abdulla
 
Hi,
Post your code here. Also make sure there is no double entry of your code like:...
Herte you go Zameer

Private Sub carfrom_AfterUpdate()
Call FiveSec
End Sub
Private Sub Combo96_Click()
Me.Text243 = [Text137]
End Sub

Private Sub Form_Current()
Call Edit
End Sub

Private Sub Form_Load()
Call WinName
End Sub

Private Sub Text159_AfterUpdate()
If Me.Text159 = "Management System Audit" Then
Me.Label218.Visible = False
Me.Label219.Visible = False
Me.Label221.Visible = False
Me.Check223.Visible = False
Me.Check225.Visible = False
Me.Check226.Visible = False
Me.Label167.Visible = False
Me.Combo98.Visible = False
Me.Text100.Visible = False
Me.Label189.Visible = True
Me.Text188.Visible = True
Me.Text191.Visible = True
Me.Label168.Visible = True
Me.Label201.Visible = False
Me.Label196.Visible = False
Me.Label212.Visible = False
Me.Label208.Visible = False
Me.Label200.Visible = False
Me.Label195.Visible = False
Me.Label215.Visible = False
Me.Label194.Visible = False
Me.Label199.Visible = False
Me.Label206.Visible = False
Me.Combo204.Visible = False
Me.Combo202.Visible = False
Me.Combo197.Visible = False
Me.Text216.Visible = False
Me.Text213.Visible = False
Me.Text205.Visible = False
Me.Text210.Visible = False
Me.Combo96.Visible = True
Me.Label166.Visible = True
ElseIf Me.Text159 = "Record Review" Then
Me.Text100.Visible = True
Me.Label194.Visible = True
Me.Label195.Visible = True
Me.Label196.Visible = True
Me.Combo197.Visible = True
Me.Combo98.Visible = True
Me.Combo96.Visible = False
Me.Text216.Visible = False
Me.Text213.Visible = False
Me.Text205.Visible = False
Me.Text188.Visible = False
Me.Text210.Visible = False
Me.Text191.Visible = False
Me.Label218.Visible = False
Me.Label219.Visible = False
Me.Label221.Visible = False
Me.Check223.Visible = False
Me.Check225.Visible = False
Me.Check226.Visible = False
Me.Combo204.Visible = False
Me.Combo202.Visible = False
Me.Label189.Visible = False
Me.Label201.Visible = False
Me.Label215.Visible = False
Me.Label212.Visible = False
Me.Label208.Visible = False
Me.Label200.Visible = False
Me.Label168.Visible = False
Me.Label167.Visible = False
Me.Label166.Visible = False
Me.Label206.Visible = False
Me.Label199.Visible = False
ElseIf Me.Text159 = "Document Review" Then
Me.Label196.Visible = False
Me.Label194.Visible = False
Me.Label195.Visible = False
Me.Text216.Visible = False
Me.Text213.Visible = False
Me.Text205.Visible = False
Me.Text188.Visible = False
Me.Text210.Visible = False
Me.Text191.Visible = False
Me.Label218.Visible = False
Me.Label219.Visible = False
Me.Label221.Visible = False
Me.Check223.Visible = False
Me.Check225.Visible = False
Me.Check226.Visible = False
Me.Combo204.Visible = False
Me.Label189.Visible = False
Me.Label215.Visible = False
Me.Label212.Visible = False
Me.Label208.Visible = False
Me.Label168.Visible = False
Me.Label167.Visible = False
Me.Label166.Visible = False
Me.Label206.Visible = False
Me.Text100.Visible = True
Me.Combo98.Visible = True
Me.Label199.Visible = True
Me.Label200.Visible = True
Me.Label201.Visible = True
Me.Combo202.Visible = True
Me.Combo96.Visible = False
ElseIf Me.Text159 = "DD 250" Then
Me.Label206.Visible = True
Me.Label208.Visible = True
Me.Label219.Visible = True
Me.Label218.Visible = True
Me.Label221.Visible = True
Me.Check226.Visible = True
Me.Check225.Visible = True
Me.Check223.Visible = True
Me.Text213.Visible = False
Me.Text205.Visible = True
Me.Combo204.Visible = True
Me.Combo98.Visible = False
Me.Text100.Visible = False
Me.Combo96.Visible = False
Me.Label166.Visible = False
Me.Label167.Visible = False
Me.Label168.Visible = False
Me.Text191.Visible = False
Me.Label212.Visible = False
Me.Label200.Visible = False
Me.Label195.Visible = False
Me.Label189.Visible = False
Me.Label199.Visible = False
Me.Label194.Visible = False
Me.Label215.Visible = False
Me.Label201.Visible = False
Me.Label196.Visible = False
Me.Text210.Visible = False
Me.Text188.Visible = False
Me.Text216.Visible = False
Me.Combo202.Visible = False
Me.Combo197.Visible = False
Me.Check223 = True
ElseIf Me.Text159 = "DD 1149" Then
Me.Label219.Visible = True
Me.Label218.Visible = True
Me.Label221.Visible = True
Me.Check226.Visible = True
Me.Check225.Visible = True
Me.Check223.Visible = True
Me.Label215.Visible = True
Me.Label212.Visible = True
Me.Text213.Visible = True
Me.Text210.Visible = True
Me.Combo98.Visible = False
Me.Text100.Visible = False
Me.Combo96.Visible = False
Me.Label166.Visible = False
Me.Label167.Visible = False
Me.Label168.Visible = False
Me.Label206.Visible = False
Me.Label208.Visible = False
Me.Label200.Visible = False
Me.Label195.Visible = False
Me.Label189.Visible = False
Me.Label201.Visible = False
Me.Label196.Visible = False
Me.Label168.Visible = False
Me.Label199.Visible = False
Me.Label194.Visible = False
Me.Combo204.Visible = False
Me.Combo202.Visible = False
Me.Combo197.Visible = False
Me.Text216.Visible = False
Me.Text205.Visible = False
Me.Text188.Visible = False
Me.Text191.Visible = False
Me.Check225 = True
ElseIf Me.Text159 = "SF 1034" Then
Me.Text216.Visible = True
Me.Label219.Visible = True
Me.Label218.Visible = True
Me.Label221.Visible = True
Me.Check226.Visible = True
Me.Check225.Visible = True
Me.Check223.Visible = True
Me.Label215.Visible = True
Me.Text210.Visible = False
Me.Text205.Visible = False
Me.Combo98.Visible = False
Me.Combo204.Visible = False
Me.Combo202.Visible = False
Me.Combo197.Visible = False
Me.Text213.Visible = False
Me.Text188.Visible = False
Me.Text100.Visible = False
Me.Text191.Visible = False
Me.Combo96.Visible = False
Me.Label166.Visible = False
Me.Label167.Visible = False
Me.Label168.Visible = False
Me.Label206.Visible = False
Me.Label208.Visible = False
Me.Label199.Visible = False
Me.Label194.Visible = False
Me.Label212.Visible = False
Me.Label200.Visible = False
Me.Label195.Visible = False
Me.Label189.Visible = False
Me.Label201.Visible = False
Me.Label196.Visible = False
Me.Check226 = True
Else: Me.Combo96.Visible = True
Me.Combo98.Visible = True
Me.Text100.Visible = True
Me.Text140.Visible = True
Me.Text183.Visible = True
Me.Label173.Visible = True
Me.Label171.Visible = True
Me.Label168.Visible = True
Me.Label167.Visible = True
Me.Label166.Visible = True
Me.Label206.Visible = False
Me.Label199.Visible = False
Me.Label194.Visible = False
Me.Label215.Visible = False
Me.Label212.Visible = False
Me.Label208.Visible = False
Me.Label200.Visible = False
Me.Label195.Visible = False
Me.Label189.Visible = False
Me.Label201.Visible = False
Me.Label196.Visible = False
Me.Label218.Visible = False
Me.Label219.Visible = False
Me.Label221.Visible = False
Me.Check223.Visible = False
Me.Check225.Visible = False
Me.Check226.Visible = False
Me.Combo204.Visible = False
Me.Combo202.Visible = False
Me.Combo197.Visible = False
Me.Text216.Visible = False
Me.Text213.Visible = False
Me.Text205.Visible = False
Me.Text188.Visible = False
Me.Text210.Visible = False
Me.Text191.Visible = False
End If
End Sub

Private Sub Text159_Click()
If Me.Text159 = "DD 1149" Then
Me.Text236 = "DD 1149"
ElseIf Me.Text159 = "DD 250" Then
Me.Text236 = "DD 250"
ElseIf Me.Text159 = "SF 1034" Then
Me.Text236 = "SF 1034"
ElseIf Me.Text159 = "Document Review" Then
Me.Text236 = "Doc Rev"
ElseIf Me.Text159 = "Inspection" Then
Me.Text236 = "Insp."
ElseIf Me.Text159 = "Mandatory Government Insp" Then
Me.Text236 = "MGI"
ElseIf Me.Text159 = "Management System Audit" Then
Me.Text236 = "MSA"
ElseIf Me.Text159 = "Product Audit" Then
Me.Text236 = "Prod Audit"
ElseIf Me.Text159 = "Process Evaluation" Then
Me.Text236 = "P E"
ElseIf Me.Text159 = "Record Review" Then
Me.Text236 = "R R"
ElseIf Me.Text159 = "Walkdown" Then
Me.Text236 = "W/D"
ElseIf Me.Text159 = "Witness" Then
Me.Text236 = "Wit"
End If
End Sub
Private Sub View_Instructions_Click()
If Me.Text159 = "Witness" Then
DoCmd.OpenForm "frmwitnessinst", acNormal
ElseIf Me.Text159 = "Walkdown" Then
DoCmd.OpenForm "frmwalkdowninst", acNormal
ElseIf Me.Text159 = "Mandatory Government Insp" Then
DoCmd.OpenForm "frmmgiinst", acNormal
ElseIf Me.Text159 = "Inspection" Then
DoCmd.OpenForm "frminspinst", acNormal
ElseIf Me.Text159 = "Process Evaluation" Then
DoCmd.OpenForm "frmevalinst", acNormal
ElseIf Me.Text159 = "Product Audit" Then
DoCmd.OpenForm "frmProductAuditinst", acNormal
ElseIf Me.Text159 = "Record Review" Then
DoCmd.OpenForm "frmRRinst", acNormal
ElseIf Me.Text159 = "Document Review" Then
DoCmd.OpenForm "frmDRinst", acNormal
ElseIf Me.Text159 = "DD 250" Then
DoCmd.OpenForm "frmDD250inst", acNormal
ElseIf Me.Text159 = "DD 1149" Then
DoCmd.OpenForm "frmDD250inst", acNormal
ElseIf Me.Text159 = "SF 1034" Then
DoCmd.OpenForm "frmDD250inst", acNormal
ElseIf Me.Text159 = "Management System Audit" Then
DoCmd.OpenForm "frmsmsasinst", acNormal
End If
End Sub
Private Sub Print_Record_Click()
On Error GoTo Err_Print_Record_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

Exit_Print_Record_Click:
Exit Sub

Err_Print_Record_Click:
MsgBox Err.Description
Resume Exit_Print_Record_Click

End Sub

Private Sub Command133_Click()
On Error GoTo Err_Command133_Click


DoCmd.PrintOut

Exit_Command133_Click:
Exit Sub

Err_Command133_Click:
MsgBox Err.Description
Resume Exit_Command133_Click

End Sub
Private Sub Command134_Click()
On Error GoTo Err_Command134_Click


DoCmd.Close

Exit_Command134_Click:
Exit Sub

Err_Command134_Click:
MsgBox Err.Description
Resume Exit_Command134_Click

End Sub
Private Sub Command135_Click()
On Error GoTo Err_Command135_Click


DoCmd.PrintOut

Exit_Command135_Click:
Exit Sub

Err_Command135_Click:
MsgBox Err.Description
Resume Exit_Command135_Click

End Sub

Private Sub Command140_Click()
On Error GoTo Err_Command140_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.PrintOut acSelection

Exit_Command140_Click:
Exit Sub

Err_Command140_Click:
MsgBox Err.Description
Resume Exit_Command140_Click

End Sub



Public Function WinName()
Me.username = GetWindowsUserName
End Function

Public Function Edit()
If Me!username = [tblpersonnel.username1] Then
AllowEdits = True
ElseIf Me.username = "martiscm" Then
AllowEdits = True
ElseIf Me.username = "larsong" Then
AllowEdits = True
Else: AllowEdits = False
End If
End Function




regards
Zameer Abdulla

 
well, the error message said that it's in the onLoad function...

and in the onLoad function, all you have is Call WinName

so maybe it's a problem with the WinName function, which I presume is a custom function you created...

--------------------
Procrastinate Now!
 
I get the error even after the form is open, each time I navigate to the next record it give me that message but instead of saying "The expression On Load", it says "On Click". Could the code be to confusing?
 
Are any controls on your form bound to OLE object fields? (Check the field definitions for 'OLE object' in the underlying tables.) If so, the OLE server may not be installed or registered on your machine, or you may perhaps have a different and incompatible OLE server registered for the type of data stored in the field.

Also check for broken References (Tools menu in VBE; look for a line with MISSING: before the library name).

If these are no help, try single stepping through the Current event procedure (if you have one) to see if the error occurs in your code or in Access/VB code.

Rick Sprague
Want the best answers? See faq181-2886
To write a program from scratch, first create the universe. - Paraphrased from Albert Einstein
 
Hi,
I can't find
Private Sub carfrom_AfterUpdate()
Call FiveSec
End Sub
what is that?
The WinName function must be a custom made one. May be that creates problem as Crowley16 said.
For a good function check this link

For error checking remove the functions and add again one by one. It is easy to find which function is troubling you.
regards

Zameer Abdulla
 
Here is the FiveSec function

Public Function fivesec()
If Me.username = "larsong" Then
Me.Text243 = "RMQX"
End If
If Me.username = "buckc" Then
Me.Text243 = "RMQM"
End If
If Me.username = "abramd" Then
Me.Text243 = ""
End If
If Me.username = "combsc" Then
Me.Text243 = "RMQE"
End If
If Me.username = "demackd" Then
Me.Text243 = "RMQM"
End If
If Me.username = "dohertyj" Then
Me.Text243 = "RMQX"
End If
If Me.username = "feliciaj" Then
Me.Text243 = "RMQO"
End If
If Me.username = "hansonr" Then
Me.Text243 = "RMQL"
End If
If Me.username = "hartmand" Then
Me.Text243 = "RMQE"
End If
If Me.username = "abramd" Then
Me.Text243 = "RMQL"
End If
If Me.username = "koernerg" Then
Me.Text243 = "RMQM"
End If
If Me.username = "martinm" Then
Me.Text243 = "RMQL"
End If
If Me.username = "matyeg" Then
Me.Text243 = "RMQE"
End If
If Me.username = "pascuaf" Then
Me.Text243 = "RMQM"
End If
If Me.username = "perad" Then
Me.Text243 = "RMQE"
End If
If Me.username = "petrob" Then
Me.Text243 = "RMQO"
End If
If Me.username = "slinkarj" Then
Me.Text243 = "RMQL"
End If
If Me.username = "smithfu" Then
Me.Text243 = "RMQL"
End If
If Me.username = "tellesa" Then
Me.Text243 = "RMQO"
End If
If Me.username = "terryj" Then
Me.Text243 = "RMQL"
End If
If Me.username = "watsond" Then
Me.Text243 = "RMQL"
End If
If Me.username = "YeakeyE" Then
Me.Text243 = "RMQM"
End If
If Me.username = "zahnd" Then
Me.Text243 = "RMQM"
End If
If Me.username = "jonesda" Then
Me.Text243 = "RMQM"
End If
If Me.username = "florencp" Then
Me.Text243 = "RMQM"
End If
If Me.username = "maningao" Then
Me.Text243 = "RMQO"
End If
If Me.username = "martiscm" Then
Me.Text243 = "RMQX"
End If
If Me.username = "smithgr" Then
Me.Text243 = "RMQX"
End If
If Me.username = "schultzs" Then
Me.Text243 = "RMQE"
End If
If Me.username = "grimmd" Then
Me.Text243 = "RMQM"
End If
End Function
 
Wow I just have to say this is alotta code. Why don't you just have this info in a table? Seems like it'd be easier to maintain.
Also it'd be a good idea to name your form controls something other than the default names Access gives them when you create them, like combo98 and text212. Giving them more descriptive names can help a lot.

That being said...

As for function WinName, I see you have this:

Public Function WinName()
Me.username = GetWindowsUserName
End Function

ONce you call this, the function doesn't know what "ME" is cause you're no longer on a form.
Usually a function returns something.
Usually you'd have something in your code like

me.username = WinName

and the code for WinName would be

Public Function WinName()
WinName = GetWindowsUserName
End Function

Actually I don't even really see the sense in the WinName function only just calling another function. YOu could just as well have:

me.username = GetWindowsUserName

Hope this helps.

g
 
Herd, just to digress slightly, as Ginger intimated, with all due respect, your code could be reduced dramatically.

With all due respect to Ginger also, sometimes I'll keep my control names with a text value, so iteration is easier.
(not necessarily in this case though...

Dim sLetter As String(1)

Select Case Me.UserName
Case "Larsong" Or "dohertyj" :sLetter = "X"
Case "buckc" Or "demackd" Or "koernerg" Or "pascuaf" :sLetter = "M"
Case "combsc" Or "hartmand" Or "matyg" Or "peraud" :sLetter = "E"
Case "felicia" Or "petrob" Or tellesa" :sLetter = "O"
Case "hansonr" Or "abramd" Or "martinm" Or "slinkarj" :sLetter = "L"
.....
End Select

Me.Text243 = "RMQ" & sLetter

same idea, for a few of your other functions.




Numerals for control names (as Stated above...


Dim x As Integer, y As integer, z As Integer

If Me.Text159 = "DD 250" Then

For x = 100 to 184 'making up numbers here..
Me("Text" & x).Visible = False
Next x

For y = 168 To 298
Me("Label" & y).Visible = False
Next y

For z = 121 To 234
Me("Check" & z).Visible = False
Next z

ElseIf Me.Text159 = "FIN 345" Then
...


Just some ideas, hope you dont mind...

Good luck either way!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top