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

Subform ADODB Troubles!

158 100+
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 1513
Stewart Ross
2,545 Expert Mod 2GB
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 Expert 2GB
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 100+
Thanks for the responses! Stewart was right my database was corrupted...turns 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
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...
0
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...
25
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...
0
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...
1
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...
9
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...
19
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...
11
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...
0
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...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
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:
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...

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.