473,727 Members | 2,034 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

"Property let procedure..." error occurs when opening form determined by listbox data

25 New Member
Hi, I'm trying to create a form with a list box with 2 columns and a button that opens the selected record in the appropriate form. In the sample below, the first column lists the type of equipment (labeled Category) and the second column lists the equipment's serial number (SerialNo). The sub is supposed to use the Category data (say, Cameras) to select the appropriate form (in this case, AcctgDECameras) with the record containing the matching serial number.

Unfortunately, I get this error instead:
"Property let procedure not defined and property get procedure did not return an object."

I suspect the problem lies in the mutliple "ElseIf" statements.

Here's the code:

Expand|Select|Wrap|Line Numbers
  1. Dim stDocName As String
  2. Dim stLinkCriteria As String
  3. Dim stCategory As String
  4.  
  5. stCategory = Me.AssetList.Column(0)
  6.  
  7. If stCategory = "Computers" Then
  8. stDocName = "AcctgComputers"
  9. ElseIf stCategory = "Cameras" Then stDocName = "AcctgDECameras"
  10. ElseIf stCategory = "Monitors" Then stDocName = "AcctgDEMonitors"
  11. ElseIf stCategory = "MFCs" Then stDocName = "AcctgDEMFCs"
  12. ElseIf stCategory = "Printers" Then stDocName = "AcctgDEPrinters"
  13. ElseIf stCategory = "Docks" Then stDocName = "AcctgDEDocks"
  14. ElseIf stCategory = "PDAs" Then stDocName = "AcctgDEPDAs"
  15. ElseIf stCategory = "Other DE" Then stDocName = "AcctgDEOthers"
  16. End If
  17.  
  18. stLinkCriteria = "[SerialNo]=" & "'" & Me![AssetList]!Column(1) & "'"
  19. DoCmd.OpenForm stDocName, , , stLinkCriteria
  20.  
Suggestions would be welcome!
Dec 5 '07 #1
4 4915
FishVal
2,653 Recognized Expert Specialist
Hi, dstorms.

Try to replace
Expand|Select|Wrap|Line Numbers
  1. stLinkCriteria = "[SerialNo]=" & "'" & Me![AssetList]!Column(1) & "'"
  2.  
with
Expand|Select|Wrap|Line Numbers
  1. stLinkCriteria = "[SerialNo]=" & "'" & Me![AssetList].Column(1) & "'"
  2.  
Regards,
Fish
Dec 5 '07 #2
Denburt
1,356 Recognized Expert Top Contributor
After reviewing the code you posted, I would start out by debugging the procedure and see if strDocname actually contains a valid form name.


Debug.print stDocName
DoCmd.OpenForm stDocName, , , stLinkCriteria
Dec 5 '07 #3
dstorms
25 New Member
FishVal found the error. Now it works! Thanks to both for responding.
Dec 6 '07 #4
FishVal
2,653 Recognized Expert Specialist
FishVal found the error. Now it works! Thanks to both for responding.
Hi, dstorms.

Hope you understand difference between "." and "!" operators.
They are completely different.
  • "." is for referencing object's property/method
  • "!" is for referencing collection's member
    expression like
    Expand|Select|Wrap|Line Numbers
    1. CollectionName!CollectionMemberName
    2.  
    is a full equivalent of
    Expand|Select|Wrap|Line Numbers
    1. CollectionName.Item("CollectionMemberName")
    2.  
    the only difference is that the first is faster and the second is more flexible
    • the first is a static reference which allows compiler to resolve the reference before execution thus optimizing code performance
    • the second is a dynamic reference allowing to get collection member by a string type Item property argument

People are getting confused because in many cases one may be used instead of other without any noticeable difference. This is not some special feature of VBA syntax, it is a feature of Access object model.

For example:

#1. Me.ControlName
and
#2. Me!ControlName

this will give a reference to the same control but via different routes.
Some words about "Me".
  • "Me" is a special name returning object the executing code belongs to
  • Each time a new form is created Access creates a new class Form_FormName (you see it in project explorer under forms' modules
  • So in a form module "Me" returns object of Form_FormName class
  • Form_FormName class inherits all properties of Access.Form class and has it own (for example Form_FormName.C ontrolName used in #1)
  • the first expression will call property ControlName (see above) which will return reference to the control's object
  • the second works in the following way
    • Form_FormName is not a Collection, thus using "!" operator seems to be senseless
    • But inheriting Access.Form class, Form_FormName class inherits its default property Controls which returns collection.
      Thus
      Expand|Select|Wrap|Line Numbers
      1. Me!ControlName
      2.  
      is just the same as the following with explicitely called default property
      Expand|Select|Wrap|Line Numbers
      1. Me.Controls!ControlName
      2.  

Best regards,
Fish

P.S. If that makes a sense you may see clearly what was wrong in your original syntax.
Dec 6 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
6422
by: Jules Dubois | last post by:
I'm want to create a superclass with nothing but attributes and properties. Some of the subclasses will do nothing but provide values for the attributes. (I'd also like to make sure (1) that the subclass provides actual values for the attributes and (2) that no "client" module adds or removes attributes or properties, but I don't know how to do those.) I don't understand what I'm doing wrong, or maybe what I want to do is impossible. ...
5
2476
by: Mark Hannon | last post by:
I have been researching the "disabled" property for form data and wanted to know: - Does the disabled property supress the form item from being submitted? - Can the disabled property be applied when the submit button is pressed? I am designing a PayPal order page that will have 4 items, each with a 3-character text box where the customer will enter quantity. The default value will be "0." I want to be able to test whether the
2
325
by: Boniek | last post by:
Hi, How I can create property to binding with other objects. I want to create a data object which work as a DataTable. DataTable contains columns and dataTable is used to binding with a textBox etc. How I can create that object but I don't want any static properties in source code. I implemented IDataBinding in my object but when I'm binding my TextBox to this data object than my application raise exception which tell me that my object...
1
16453
by: Dr. J | last post by:
I have an application that opens a socket and connects to another application listening over a port. The problem I am encountering is that when the listening application is closed my application cannot detect it to take appropriate action. I am using "Connected" property of the Socket class, but it seems this property does not reflect the true state of the socket connection. Here is the code snippet. Basically, I am checking the...
15
12537
by: simonoficina | last post by:
Hello all! I am a vb.net beginner in Spain. When I use VB6 ,the button object has a property called "default" that can set this button like press "ENTER" key. But in the VB.net I can't find this property. Where is it? Or mabye change the other thing,No?Thanks ! Simon
1
3207
by: Bill Stillwell | last post by:
I am trying to set the "backcolor" property in fields in a form. It sets okay using a macro (setvalue). But when I close the form, the property settings revert back to what they were before I closed the form. So when I reopen the form, the settings are not changed. If I manually change the settings while not in Design mode (using the "fill with" icon), the settings hold. If I change the settings while in Design mode, the settings do not...
16
5181
by: mj.redfox.mj | last post by:
Can anyone help? I have a textbox which I'm programatically adding by using the following code: txtTest = New TextBox txtTest.ID = "txtLeft" + cntCount.ToString Page.FindControl("tdInput").Controls.Add(txtTest) This successfully creates a textbox called "txtLeft1" in the table
8
1359
by: kimiraikkonen | last post by:
Hi, Just noticed that you're allowed to use combobox1.items.item property in VB.NET but NOT in C#... Intellisense doesn't show "item" property and build is failed. Is there a specific reason for that or is it a mistake? (Using VC# 2005 express + .NET 2.0) Thanks,
0
8752
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,...
0
9406
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6703
isladogs
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...
0
6012
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4521
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...
0
4786
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2641
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2158
bsmnconsultancy
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.