473,378 Members | 1,523 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,378 software developers and data experts.

The object doesn't contain the Automation object! HELP :(

FILL TWO FIELDS FROM ONE COMBO BOX
---------------------------------------------
Form: Violation Add
Field: ViolatorNum
Field Event= On Change
Macro Name: AddViolatorFirstLast
Set Value

Item: [Forms]![Violation Add]![FirstName]
Expression: [Add Charge Violator].[column](2)

Item: [Forms]![Violation Add]![LastName]
Expression: [Add Charge Violator].[column](3)
----------------------------------------------------
I simply have a MACRO which uses a 3 column combo box to fill 3 blanks simultaneously. Contact number, first name and last name.

The MACRO works to perfection, THEN gives me this annoying error message talking about V-Basic. I AM NOT USING V-Basic.

PLEASE HELP
Attached Images
File Type: jpg issue1.jpg (147.4 KB, 127 views)
File Type: jpg issue2.jpg (54.3 KB, 121 views)
Mar 31 '20 #1
4 2613
twinnyfo
3,653 Expert Mod 2GB
WebMasterJ,

Welcome to Bytes!

It would help to see the Macro itself, since that is generating the error.

Please post the Macro and we'll see if we can hepp!
Mar 31 '20 #2
@twinnyfo
THANKS for responding :)
Here is all that the macro contains:

Macro Name: AddViolatorFirstLast
Set Value

Item: [Forms]![Violation Add]![FirstName]
Expression: [Add Charge Violator].[column](2)

Item: [Forms]![Violation Add]![LastName]
Expression: [Add Charge Violator].[column](3)
Mar 31 '20 #3
twinnyfo
3,653 Expert Mod 2GB
I guess I would begin by saying avoid using Macros at all costs, simply because VBA is so much more flexible, and once you start using it, you will find it to be rather easy for your basic activities in your db.

Second, I would advise you to rename all of your tables, forms, fields and objects, so that there are no spaces included in the names. This makes things easier overall (no need to constantly include square brackets for your form and field names).

Third, I would very highly encourage you to make sure you rename all of the controls on your forms so that they do not match the names of your fields. For example, if you have Form bound to the Table tblInformation, which has a Field InfoID, and you have a Text Box Control on your Form that is bound to the Field InfoID, you would not want to name that Control "InfoID," as this automatically creates an ambiguous naming situation. In most cases, Access is able to figure it out, but in some cases, it can create problems (which could be your situation here). For example, on the above mentioned form, the term Me.InfoID could refer to either the field in the table or the text box.

So, find an adequate naming convention for your DB controls and stick with it. For example, all my tables begin with "tbl", queries "qry", text boxes "txt", etc. This prevents ambiguity and helps others to troubleshoot your work. Let's use your example:

Expand|Select|Wrap|Line Numbers
  1. Item: [Forms]![Violation Add]![FirstName]
  2. Expression: [Add Charge Violator].[column](2)
Because you use [Forms], I know that you have a form names "Violation Add." However, I don't know if it is a main form or a subform (I name my subforms "fsub"). Next, does "FirstName" refer to the Field underlying the form or to some sort of control on the form? What type of control it is? Is it a text box? A Check box? A Combo Box? List Box? Option Group?

Finally, you say you have a three-column combo box, but you refer to Column(3). That implies you have a four-column combo box, as column numbers begin at 0.

Below, an example of the simplicity of VBA (I've renamed your controls to make it easier to understand):

Expand|Select|Wrap|Line Numbers
  1. Private Sub cboViolator_AfterUpdate()
  2.  
  3.     Me.txtFirstName = Me.cboViolator.Column(1)
  4.     Me.txtLastName = Me.cboViolator.Column(2)
  5.  
  6. End Sub
Even if you know absolutely nothing about VBA at this point (I hope you know at least a little bit), you should be able to see how simple and straightforward this code is: After you select someone from the Combo Box, it updates the First and Last Names to the values in the columns from the Combo Box.

Plus, once you learn more about VBA, you will be able to manipulate the data in whatever way you like. This makes your projects much more powerful, flexible and robust.

I admit that this is not solving the problem of your error, but I suggest that there may be other minor things that could be adjusted and improved which may avoid future errors like this.

Hope this hepps!
Mar 31 '20 #4
THANK YOU!!! I will try
Mar 31 '20 #5

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

Similar topics

3
by: Gigi | last post by:
Hi, I need access to a function object that corresponds to a frame object in a certain case from inside the function. I can get the frame object using: f = sys._getframe(0) But the...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
10
by: Steven Blair | last post by:
Hi, Quick overview of the problem: public bool Something( out DataSet ds ) { bool ret=false; try {
0
by: a | last post by:
I have a custom object that inherits from CollectionBase and it does not successfully bind to GridViews or DropdownLists. My understanding is that that is because GridViews and Dropdownlists...
13
by: Fredrik Strandberg | last post by:
Hi! I receive an object as a System.Object argument to a method. I need to check if the object is a Type object or not (that is, not a specific type, but if the object is a type object in...
1
by: acog1 | last post by:
Hi everyone, I know that there is a question similar to this already posted but the answer to it does not really seem to relate to my problem! So here goes... I have a main form which has a tab...
10
by: Jess | last post by:
Hello, If I create a temporary object using a dynamically created object's pointer, then when the temporary object is destroyed, will the dynamically created object be destroyed too? My guess...
3
by: callre | last post by:
when i used javascript onchange() the error is coming "object doesnt support this property" my code is- <script type='text/javascript' language="javascript"> function change() { ...
3
by: =?Utf-8?B?S2F5xLFoYW4=?= | last post by:
In my project,i added datagridview to my form , i transfered my table to datagridview and added multiple rows and when i called dataadapther.update ,,result is ok. But when i tried it for the...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.