473,785 Members | 2,924 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Subform ADODB Troubles!

158 New Member
I keep getting the following error:

The expression after update you entered as the event property setting produced the following error: a problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX control

Whats happening is that i have the user click a drop down box (which is populated by a table) then choose the item and it fills in the description and price with the following vba code: (Also this is in a subform)

Expand|Select|Wrap|Line Numbers
  1. If (Not IsNull(Me.Part_Number) And Not IsNull(Me.Qty)) Then
  2.  
  3. Dim rs As ADODB.Recordset
  4.  
  5. Set rs = New ADODB.Recordset
  6.  
  7. rs.Open "ItemMaster", CurrentProject.Connection, adOpenKeyset, adLockOptimistic, adCmdTable
  8. rs.MoveFirst
  9. rs.Find "Item='" & Me.Part_Number & "'"
  10.  
  11. If rs.EOF = True Then GoTo Stepout
  12.  
  13.     Me.Description.Value = rs.Fields("Description").Value
  14.     Me.Item_Cost.Value = rs.Fields("Cost").Value
  15.  
  16. Stepout:
  17.  
  18.     rs.Close
  19.     Set rs = Nothing
  20.  
  21.     Me.Total_Cost_of_Item = Me.Qty * Me.Item_Cost
  22.  
  23. End If

Can i not run adodb in a subform?

Any help would be extremely appreciated!
Thanks
Aug 26 '08 #1
3 1529
Stewart Ross
2,545 Recognized Expert Moderator Specialist
Hi. In my opinion this is not a problem caused by your code, but by some form of corruption of the form itself. I had exactly the same error in an on-click event within a subform two days ago - the code itself was fine and had been working perfectly throughout test. Without warning the error message you quote appeared. Compact/repair made no difference.

There was no clue as to what had gone wrong. I resolved my problem by saving a copy of the subform - right clicking on the form's name in the Access form tab, Save As, save under a new name, renamed the troublesome original, renamed the fresh copy back to the same name as the original was. Why this resolved it I don't know, but it did.

-Stewart
Aug 27 '08 #2
FishVal
2,653 Recognized Expert Specialist
If that is all the code, then there is no need to open recordset using adOpenKeyset cursor. Try to use adOpenDynamic instead.

As well as there is no need to open whole table and use Find method then. Why not to use a simple SQL expression with criterion in WHERE clause?

And finally you may well use DLookUp() function here.

And even more finally :), if Part_Number control is combobox you may retrieve [Cost] and [Description] values into invisible columns to always keep them on-hand.

Regards,
Fish.
Aug 27 '08 #3
Jollywg
158 New Member
Thanks for the responses! Stewart was right my database was corrupted...tur ns out the library files were overwritten with an older version of access...i've rebuilt the database and it works fine now.

Thanks Again!
Aug 27 '08 #4

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

Similar topics

11
11561
by: Ian Ornstein | last post by:
in posting http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&newwindow=1&selm=bmEK9.43452%24lj.1060600%40read1.cgocable.net Lyle showed us that an ADODB.Recordset can be created and attached to a continuous (and datasheet) form. I needed it for a data entry subform and I haven't been able to get it to work. Is there any rational for why it doesn't work with a subForm? Any suggestions for a datasheet data entry subform with two...
0
2355
by: CSDunn | last post by:
Hello, In Access ADP's that connect to SQL Server databases, any time I have a situation where I have a combo box in a main form that looks up a record in a subform, the subform record source has to be based on either a View or a Table. I can almost always use a View, and it helps to do this since I can have better control over the size of the RecordSet of the subform. There are times when the use of a Stored Procedure would give me...
25
10266
by: Lyn | last post by:
Hi, I am working on a genealogy form. The only table (so far) lists everybody in the family, one record per person. Each record has an autonum ID. The parent form (frmMainForm) displays the data in each record, which includes the ID of the father and the mother (who also have records in the table). One record per form. I have a Tab Control in the form, and in one of the tabs I have a subform (sfmSiblings) in which I wish to list...
0
1646
by: sneal | last post by:
A little background: We have an Access 2002 based user interface to our SQL Server 2000 database. The interface is a tabbed form with two of the tabs containing a subform. Data is pulled from the SQL Server using several stored procedures, one sproc for the main form and an additional sproc for each subform. All data is pulled from the SQL Server using ADO; the resulting client side (disconnected) ADODB.Recordset is then applied to each...
1
1603
Andrew Thackray
by: Andrew Thackray | last post by:
Hi Can anyone help. I have an obscure problem with an unbound sub form on my main form. Both forms are unbound as my data structure is too complex for a sinngle binding. In the main form I have been setting the sub forms recordsource property and refreshiug it each time I want to change the records displayed. The data in the subform has an association via a secondary key to a primary table This worked fine until I converted the data to...
9
9701
by: Ecohouse | last post by:
I have a main form with two subforms. The first subform has the child link to the main form identity key. subform1 - Master Field: SK Child Field: TrainingMasterSK The second subform has a master-child link to the first subform. subform2 - Master Field: subTrainingModule.Form!TrainingModuleTopicSK Child Field: TrainingModuleTopicSK
19
2997
by: hexagram | last post by:
Hi guys good day, can anybody help for my problem The Scenario is A Listbox (ID) - Multiple Select - everytime i choose in the list box the following outbound textbutton and subform will retrieve in my form- the folliwng value will get from another form i have a code but i need to customize it because everytime i choose ID in my list box my value in subform is multiplying by row i mean the value in subform is duplicating
11
7178
by: mrowe | last post by:
I am using Access 2003. (I am also using ADO in the vast majority of my code. I recently read a post that indicated that ADO is not all that is was initially cracked up to be. In the back of my mind I am wonder if this is causing my problem, but I don’t want to go through the work to convert to DAO unless I know it is truly in my best interest.) I am having problems getting a requery to show up consistently on a couple of forms. I have...
0
1724
by: dmckenna | last post by:
I've been tasked to upgrade an old system and there's many different versions of VB code that uses MDAC to talk to MSSql. Do you know what the difference is between the two code versions? Is there problems with re-opening connections all the time? Version 1 of the program is:
0
9480
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
10315
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
10147
jinu1996
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...
0
9947
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
7494
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
6737
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
5379
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
5511
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2877
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.