473,395 Members | 1,762 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

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

25
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 4883
FishVal
2,653 Expert 2GB
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 Expert 1GB
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
FishVal found the error. Now it works! Thanks to both for responding.
Dec 6 '07 #4
FishVal
2,653 Expert 2GB
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.ControlName 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
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...
5
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...
2
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...
1
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...
15
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...
1
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...
16
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...
8
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
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,...
0
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,...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.