There is a compiling error in our form (1 Viewer)

access2010

Registered User.
Local time
Yesterday, 23:06
Joined
Dec 26, 2009
Messages
1,019
The form = VendorContact’sDiary

The button [K] Vendor_Website

The = OnClick = [Event Procedure] is not copying the contents of the field [Vendor_Contacts.VC_WebSite] as a compiling error is occuring

Your assistance will be appreciated.

Nicole
 

Attachments

  • K_Copy_WebSite_Address.mdb
    176 KB · Views: 60

June7

AWF VIP
Local time
Yesterday, 22:06
Joined
Mar 9, 2014
Messages
5,424
There is no field nor control named Vendor_Contacts_Vendor_Website. There is a textbox named Vendor_Contacts.VC_Website

Should not use punctuation/special characters (underscore only exception) in naming convention.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:06
Joined
Feb 28, 2001
Messages
27,001
If there is a Compile error, you SHOULD have gotten a situation where compiling from the Code window's menu bar jump-scrolls you to the offending line.

But if you don't have "Option Explicit" in place for that module (whether general or class module doesn't matter, it applies to both) then that jump action won't occur.

Instead, the compiler would just silently CREATE a variable to match the incorrect name. Which is probably what happened in your case. I didn't open the DB because it just isn't what I do, so that means I can't tell whether you in fact DO have Option Explicit in the appropriate declaration area of your modules.

And IF my guess was right, this situation is an example of WHY you want to use Option Explicit at the top of EVERY module.
 

June7

AWF VIP
Local time
Yesterday, 22:06
Joined
Mar 9, 2014
Messages
5,424
Module has neither Option Explicit nor Option Compare Database. The compiler still jumps to the offending line because of the Me. qualifier prefix. The error is "Method or data member not found."

Next time, post the EXACT error message.
 

The_Doc_Man

Immoderate Moderator
Staff member
Local time
Today, 01:06
Joined
Feb 28, 2001
Messages
27,001
Thanks, June7. I don't open randomly posted database ever since I got one that my anti-virus flagged for me.
 

access2010

Registered User.
Local time
Yesterday, 23:06
Joined
Dec 26, 2009
Messages
1,019
Thank you for your suggestions for our MsAccess 2003 Database.
Below is our code which produces an error message.
Can you please advise as to what I have done wrong?
===

Private Sub K_Vendor_Website_Click()
If Nz(Me.Vendor_Contacts_K_Vendor_Website, "") <> "" Then
With Me.Vendor_Contacts_K_Vendor_Website
SetFocus
SelStart = 0
SelLength = Len(.Text)
End With
DoCmd.RunCommand acCmdCopy
'MsgBox "Text Copied into Memory"
Else
MsgBox "There is no text for copying"
End If
End Sub
 

June7

AWF VIP
Local time
Yesterday, 22:06
Joined
Mar 9, 2014
Messages
5,424
As already suggested, use the actual name of the control or change the name of control to match the code. See post #2.

You still didn't post the EXACT error message.

Also, post code between CODE tags to retain indentation and readability.
 

AccessBlaster

Registered User.
Local time
Yesterday, 23:06
Joined
May 22, 2010
Messages
5,828
The control you are referencing in your VBA does not exist in your table or anywhere else. Hence the error "Method or data member not found". As June7 has alluded to.

 

Attachments

  • Capture.JPG
    Capture.JPG
    64.5 KB · Views: 556

Users who are viewing this thread

Top Bottom