Hello
I don't know a thing about writing VBA Codes but this forum I was able thas helped me to finally figure out how to link the pictures to a path etc on a form. Everything works fine on the form - the pictures change with each employee etc, etc. However, when I select the command button "change picture" or "Remove", it opens the dialog box or the folder on the c:\drive etc and I can select a new picture or the one for deletion; BUT I also get a message which says compile error, syntax error and it highlights in yellow the name Private Sub cmdInsertPic_Cl ick(). The name of the form in which the employee data is stored is Employee Profile Form (from the table Employee Profile). The computer highlights the word "Profile" and gives the error (Expected =). It is possible that it is the spacing between the three words in the file name is the problem because if I were to rename the form to a single word, it works. The section with the error is emboldened. The code is listed below. Any assistance you can provide would be appreciated. - Private Sub cmdInsertPic_Click()
-
-
Dim OFN As OPENFILENAME
-
On Error GoTo Err_cmdInsertPic_Click
-
-
' Set options for dialog box.
-
With OFN
-
.lpstrTitle = "Images"
-
If Not IsNull([ImagePath]) Then .lpstrFile = [ImagePath]
-
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly
-
.lpstrFilter = MakeFilterString("Image files (*.bmp;*.gif;*.jpg;*.wmf)", "*.bmp;*.gif;*.jpg;*.wmf", _
-
"All files (*.*)", "*.*")
-
End With
-
-
If OpenDialog(OFN) Then
-
[ImagePath] = OFN.lpstrFile
-
Forms!Employee Profile Form![ImageFrame].Picture = [ImagePath]
-
SysCmd acSysCmdSetStatus, "Afbeelding: '" & [ImagePath] & "'."
-
End If
-
Exit Sub
-
-
Err_cmdInsertPic_Click:
-
MsgBox Err.Description, vbExclamation
-
End Sub
Thanks
Forsi
1 1483
Hi. I added code tags round your code to aid readability. As you may see above, it makes it much easier to differentiate one line from another.
The problem you are experiencing (at what is now line 17 above) results from the spaces in the form name, as you surmised. All such names - of fields, forms, reports, controls and so on - must be enclosed in rectangular brackets '[' and ']' if they contain spaces. A corrected version is shown below. - Forms![Employee Profile Form]![ImageFrame].Picture = [ImagePath]
-
SysCmd acSysCmdSetStatus, "Afbeelding: '" & [ImagePath] & "'."
The error message generated by the compiler arose because without the brackets it considered that the name of the object or variable concerned ended at the space after the word Employee - and it expected an operator such as "=" to follow.
-Stewart
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: josh dismukes |
last post by:
/// here is the code i'm getting a parse error on the last line of the
code which
/// is </html> any help will be much appreciated.
<?php
session_start ();
|
by: Paul |
last post by:
I have an Access 2000 database with a form that is giving me some
major headaches. When you open the form, it displays all records and
allows editing, but has AllowAdditions set to False so that the user
has to use my New Record button. When you click the New Record
button, the form presents a new record for editing. My client wants
to use the Escape key to cancel changes to new or existing records.
On existing records, Access already...
|
by: muralidharan |
last post by:
WebForm1.aspx Code:
<%@ Register TagPrefix="ComponentArt" Namespace="ComponentArt.Web.UI"
Assembly="ComponentArt.Web.UI" %> <ComponentArt:TreeView
id="TreeView1" Height="520" AutoPostBackOnNodeMove="false"
DragAndDropEnabled="true"
NodeEditingEnabled="False" KeyboardEnabled="true"
CssClass="TreeView" NodeCssClass="TreeNode"
SelectedNodeCssClass="SelectedTreeNode"
HoverNodeCssClass="HoverTreeNode" NodeEditCssClass="NodeEdit"
|
by: VB Programmer |
last post by:
I only have 1 set of <FORM> tags in my HTML file, but I keep getting this
error. Any ideas?
***********
A page can have only one server-side Form tag.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.
Exception Details: System.Web.HttpException: A page can have only one
|
by: Joel Byrd |
last post by:
I am making an AJAX call when any one of a number of inputs in a form
(search criteria) are clicked, checked, changed, etc. When the user
clicks, checks, whatever, I am trying to display a "Retrieving
results..." text. This should be really simple, but in IE, it does not
work. Here's the code that is not executing in IE:
And here is the context of that code, which is the AJAX function that
is called when a radio button is clicked,...
| |
by: mudasserrafiq |
last post by:
I am using following asp file default.asp
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<META content="0 Days" name=revisit-after>
<META content=info@siderinternational.com name=email>
<META content="Omer Safdar" name=author>
<META content=MegaStudios.com name=publisher>
<META content="Copyright ©2005 - MegaStudios.com" name=copyright>
<SCRIPT...
|
by: finizaini |
last post by:
I'm receiving an "Object Expected" Error (Line:309, Char:0). I'm
confused as to what is happening.Also, I can't run this code using other browser such as Fire Fox. Thispage only can view using IE. Is there something that I'm missing? The error is
pointing to
<textarea name="tairbillno" cols="25" rows="4" wrap="HARD" id="tairbillno" ONKEYDOWN="return checkMaxRow(this, 10)"></textarea>
Here is my code below:
<HTML>
<HEAD>...
|
by: ahilar12 |
last post by:
1. <head>
2. <script type="text/javascript">
3. </script>
4. </head>
5. <body>
6. <form>
7. <select name="team" id="mylist" >
8. <option></option>
9. <option>north</option>
10. <option>south</option>
|
by: graphicssl |
last post by:
Okay, so first of all, I'm a designer first and a light coder second (I'm only really trained with HTML and CSS). So I apologize for having to post about something that's probably super-trivial!
I'm working on setting up a shopping cart for a one-product web site, and I'm using HTML and CSS, with ASP for the shopping cart. The ASP takes the information from the form on the shopping cart, and formats it in to two e-mails: one for the company...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |