Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB errors in compiled program but not in VB

Status
Not open for further replies.

adamkushner

Programmer
Jan 23, 2003
4
0
0
US
I'm developing an application that is causing errors only when compiled, and only on computers other than the one I developed it on.

I've narrowed down the problem to the following code. If anyone can help me I would love to hear from you.

SaveRec rsTemp, rec
rsTemp.Update

Private Sub SaveRec(rs As ADODB.RecordSet, rec As clsParts)
rs.Fields("PartNumber1").Value = rec.PartNumber1
End Sub



 
Can you be more specific about the error and the system (eg what is the backend database?)
 
Access is the database. The program just terminates unexpectedly.

Public Sub Update(rec As clsParts)
mdiInventory.Cursor_Hourglass
Dim found As Boolean
Dim rsTemp As New ADODB.RecordSet
Dim sqlstring As String

rsTemp.Open "Select * from [PartsInv] where [InventoryNum]=" & Str$(rec.inventorynum), m_Connection, adOpenDynamic, adLockOptimistic

SaveRec rsTemp, rec
rsTemp.Update
' error occurs here: rsTemp.Update
Dim initialPosition, x2 As Integer
initialPosition = m_Recordset.AbsolutePosition
m_Recordset.Requery
m_Recordset.Move initialPosition - 1
x2 = m_Recordset.AbsolutePosition

End Sub

Thanks!!
 
how is m_connection defined?

What version of Access?

How did you install on the other PC's?

I suspect you are missing or have an outdated dll on the target PC.
 
Are you sure the error occurs there? Try placing an error handler in your function and also line numbers to see what/where the error is.
 
Access 2000.

I used the package and deployment wizard. When I installed I did have a problem with msado25.tlb registering.
 
Looks like you don't have the correct version of MDAC installed on the target PC.
msado25.tlb sounds like the type library for ADO 2.5.
I'm guessing without this, it doesn't know what an ADODB.Recordset is.
Does seem strange that you don't get an error message.
Seems like you should get something like Invalid type or something.

Check the version of MDAC on your machine and try installing that version on a target PC.

If you search the web, MS has a utility to check MDAC versions.
 
Thanks to everyone for your help. Turn out while doing work in the database inside of access I sorted the records not using the key which is an autonumber. This was causing the crash.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top