Forum Discussion
COMPILE ERROR (MS-Access)
Hi,
There are some ambiguities in your description. You write
> the project label that is in the database
1. What is "CurrentProjectName"? A field name or a control name or both? If a control, then which kind of control? A label control wouldn't have a "Value" property.
2. "in the database" is not enough. Since you are referencing it with Me, it must be in the same object (or its data source) as the code. If that's the case then:
In which kind of Access object are "CurrentProjectName" and the code? A form or a report?
Depending on your answers to all these questions, it could help to use Me! instead of Me.
Servus
Karl
****************
Access Forever News DevCon
Access-Entwickler-Konferenz AEK - 19./20.10. Nürnberg
Thank you for your reply, i am trying to pull the data from this field:
For Some reason, it works on another button we have which is where i snagged the code from, but when i add that same code to the new button is when im getting the COMPILE ERROR
This Button pulls the data im needing without an issue
using this code, it works fine for the button above but not the new button i created
Private Sub cmdCopytoEmail_Click()
Dim ol As New Outlook.Application
Dim MI As MailItem
Set MI = ol.CreateItem(olMailItem)
MI.Subject = "Proj #" & Me.ID.Value & "-" & Me.Project_Name.Value
MI.BodyFormat = olFormatHTML
MI.Display
Set MI = Nothing
Set ol = Nothing
End Sub
- Oct 02, 2024
Hi,
The property sheet shows that the text box + field name contain a space. Therefore you have to put it in square brackets in VBA: Me.[Project Name].Value
Servus
Karl
****************
Access Forever News DevCon
Access-Entwickler-Konferenz AEK - 19./20.10. Nürnberg- kevin675Oct 02, 2024Copper Contributor
Karl_Donaubauer Thank you, I seem to still have something wrong, I added the square brackets and I get the following:
- George_HepworthOct 02, 2024Silver ContributorIs the correct name of the control./field "Project Name", or "Current Project Name"?