Forum Discussion
COMPILE ERROR (MS-Access)
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
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"?
- kevin675Oct 02, 2024Copper ContributorGeorge, the correct name of the control box is "Project Name" for some reason, when i try to use that in the code it wont find that specific control box