access 2003 keeps crashing

K

kaosyeti

can anyone tell me why the following code causes access to crash? the
control in question is unbound, fyi. strangely, i ran through the code step-
by-step and it didn't seem to crash until after it finished executing but if
i remove the code, it won't crash. i'm not a developer so don't make fun.

Private Sub txtboxstocknumber_BeforeUpdate(Cancel As Integer)
Dim strWhere As String
Dim hldStockNum As String
Dim ctrlCurrent As Control

hldStockNum = Me.txtboxstocknumber
strWhere = "[stocknumber] = " & Chr(34) & hldStockNum & Chr(34)

If IsNull(DLookup("[stocknumber]", "tblusedcars", "[stocknumber] = " &
Chr(34) & hldStockNum _
& Chr(34))) = True Then
Cancel = True
Me.Undo
Call MsgBox("That stock number is not in the system. Please exit
to the Used Vehicle Manager to enter the vehicle or choose a different stock
number.", vbInformation, "New Vehicle")
Me.txtboxstocknumber.Undo
Else


If DCount("*", "tblusedcars", "[stocknumber] = " & Chr(34) &
hldStockNum _
& Chr(34)) > 1 Then
Call MsgBox("More than one vehicle record has been found with
this stock number. Please use the record navigation buttons at the bottom of
the screen to select the appropriate vehicle before making any changes.",
vbInformation, "Duplicate Stock Numbers")
Cancel = True
Me.Undo
Me.txtboxstocknumber.Undo
Me.Filter = strWhere
Me.FilterOn = True
Me.chkboxauction = -1
For Each ctrlCurrent In Me.Controls
If ctrlCurrent.Tag = "filtered" Then
ctrlCurrent.Visible = True
End If
Next ctrlCurrent
Else
Cancel = True
Me.Undo
Me.txtboxstocknumber.Undo
Me.Filter = strWhere
Me.FilterOn = True
Me.chkboxauction = -1
For Each ctrlCurrent In Me.Controls
If ctrlCurrent.Tag = "filtered" Then
ctrlCurrent.Visible = True
End If
Next ctrlCurrent
End If
End If
End Sub
 
K

kaosyeti

hey... thanks for the tip. i tried it and, to be honest, i don't know if
it did anything. access seemed to open as usual. i ran it like this:

msaccess /decompile "C:\Documents and Settings\All Users\Documents\my
database"

when it opened, it didn't do anything special/different nor did it take any
longer. and, of course, the problem is still there. thanks for trying, tho..
..8)

Alex said:
Hi,
try to decompile:
http://www.mvps.org/access/bugs/bugs0008.htm
can anyone tell me why the following code causes access to crash? the
control in question is unbound, fyi. strangely, i ran through the code
[quoted text clipped - 58 lines]
End If
End Sub
 
A

Alex Dybenko

Well, normally this helps in such cases. try to compile after this, and
compact database

--
Best regards,
___________
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com

[email protected] via AccessMonster.com said:
hey... thanks for the tip. i tried it and, to be honest, i don't know
if
it did anything. access seemed to open as usual. i ran it like this:

msaccess /decompile "C:\Documents and Settings\All Users\Documents\my
database"

when it opened, it didn't do anything special/different nor did it take
any
longer. and, of course, the problem is still there. thanks for trying,
tho..
8)

Alex said:
Hi,
try to decompile:
http://www.mvps.org/access/bugs/bugs0008.htm
can anyone tell me why the following code causes access to crash? the
control in question is unbound, fyi. strangely, i ran through the code
[quoted text clipped - 58 lines]
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top