me.txtTest.setfocus causes crash

G

Gillian

Hi

I have an If Then Else and the first test is whether the field txtTest is
null.

If that is true then i display a message box telling the user they need to
fill in the field and set the focus in the field.

I have done this a million times and never had any problems yet in this
application it crashes the database everytime.

I have put break points in the code and followed it through and it appears
to pass through to the end if as you would expect it but then the database is
just dead.

I'm using Access 2003 with a Access 2000 file format database.

Any help/suggestions would be appreciated.

Thanks
 
J

JimBurke via AccessMonster.com

Can you post the exact code you have in your If Then Else? Even though you're
explaining what you're doing, it's really necessary to see the exact
statements you have coded.
 
G

Gillian

Hi

Attached is the code, i have since discovered that it's not just the code
that crashes it. If you press the button and don't trigger the message box
and pass through to the else part after doing all of the actions perfectly
then database still crashes.

As i said previously i've used this type of code in loads of applications
and never had any problems the only thing i can think of that is different
here is that the server the files are being dropped onto is a mac server,
although don't know why that would cause a problem in the first part of the
if.

Thanks

Private Sub btnCreate_CloseRGs_Click()

DoCmd.SetWarnings False
DoCmd.Echo False

If IsNull(Me.txtCloseRGs_Location) Then

MsgBox ("You must fill in the folder to put the CloseRGs file in!!")

Me.txtCloseRGs_Location.SetFocus

Else

DoCmd.OpenQuery "qryClose_RGs_Temp_Delete"
DoCmd.OpenQuery "qryClose_RGs_Export_Delete"
DoCmd.OpenQuery "qryClose_RGs_Temp_Append"
DoCmd.OpenQuery "qryClose_RGs_Update_1"
DoCmd.OpenQuery "qryClose_RGs_Update_2"
DoCmd.OpenQuery "qryClose_RGs_Update_3"
DoCmd.OpenQuery "qryClose_RGs_Export_Append"

DoCmd.TransferText acExportDelim, "CloseRGs_Export_Spec",
"Close_RGs_Export", _
"G:\DONOR CARE TEAM\Committed Givers\Reactivate Monthly Data\" &
Me.txtCloseRGs_Location & "\CloseRGs.csv"

MsgBox "The CloseRGs file has been generated"

End If

End Sub
 
J

JimBurke via AccessMonster.com

Well you have me stumped. My suggestion would have been to step thru the code,
but you've already done that. Have you always been running a 2000 file format
in 2003? That's one area for a potential problem possibly.

One thing you could try is to cut the code from that sub (without the Sub
declaration and End sub, just from the 'DoCmd.SetWarnings False' thru the
'End If'). Whenever I do that I copy it into notepad temporarily to make sure
I don't lose it. Then delete the entire sub, do a compile, then re-create the
on_click sub and paste the copied code back in, compile it again. See if that
fixes it. That sub may have somehow been corrupted.

If that doesn't work, the only other thing I can think of is to try a
Compact/Repair and see if that fixes it. If not, then try a decompile and
another compact/repair. Every now and then I have some really strange things
happen in my DB that get fixed by doing those. I sure don't see anything in
your code that looks like it should cause a crash, but Access can do some
really strange, seemingly unexplainable things to every now and then.
 
G

Gillian

Thanks for the reply, I've tried the complie/decomplie compact etc and still
it crashes constantly.

The only reason i have the database in 2000 file format is because i have
2000 on my machine at home, i wanted to be able to take it home to work on as
the application develops.

If that's what's causing the problem i might just bite the bullet start
again in 2003 format and forget about taking it home.

Thanks
Gillian
 
J

JimBurke via AccessMonster.com

Did you try my suggestion of copying the sub code, deleting the sub and rec-
creating it? I've had that work before when I've had a corrupted DB.
Thanks for the reply, I've tried the complie/decomplie compact etc and still
it crashes constantly.

The only reason i have the database in 2000 file format is because i have
2000 on my machine at home, i wanted to be able to take it home to work on as
the application develops.

If that's what's causing the problem i might just bite the bullet start
again in 2003 format and forget about taking it home.

Thanks
Gillian
Well you have me stumped. My suggestion would have been to step thru the code,
but you've already done that. Have you always been running a 2000 file format
[quoted text clipped - 60 lines]
 
G

Gillian

Hi again

Yes i've tried that even did a rebuild and then re-created the module.

I also created a brand new database in access 2003 format imported the
object, compacted and repaired. Created the sub, compacted and repaired and i
still get it crashing.

I don't understand it at all, i'm used to building large multi-user
databases and this one is tiny and simple and doesn't even have a security
system yet and it crashes constantly.

Gillian

JimBurke via AccessMonster.com said:
Did you try my suggestion of copying the sub code, deleting the sub and rec-
creating it? I've had that work before when I've had a corrupted DB.
Thanks for the reply, I've tried the complie/decomplie compact etc and still
it crashes constantly.

The only reason i have the database in 2000 file format is because i have
2000 on my machine at home, i wanted to be able to take it home to work on as
the application develops.

If that's what's causing the problem i might just bite the bullet start
again in 2003 format and forget about taking it home.

Thanks
Gillian
Well you have me stumped. My suggestion would have been to step thru the code,
but you've already done that. Have you always been running a 2000 file format
[quoted text clipped - 60 lines]
 
J

JimBurke via AccessMonster.com

I don't know, maybe it's Access itself that has a problem - that's about the
only thing I can think of. You might want to re-post here and rather than
specifying the if-then and the set focus in your problem description, just
post it as a problem with Access unexpectedly crashing. Then in your detailed
text show the sub and explain what you've tried already. Maybe some of the
MVPs will have a suggestion. I have a lot of experience with Access, but I
don't know as much as some of the more expert-level people who post here.
Sorry I can't give you any more suggestions (other than re-installing Access!)
 
G

Gillian

Thanks for all of your help. I'll try reposting with a general problem.

I have actually already tried re-installing access, which didn't work. I
then tried re-installing the whole office suite and still no difference.

Gillian

JimBurke via AccessMonster.com said:
I don't know, maybe it's Access itself that has a problem - that's about the
only thing I can think of. You might want to re-post here and rather than
specifying the if-then and the set focus in your problem description, just
post it as a problem with Access unexpectedly crashing. Then in your detailed
text show the sub and explain what you've tried already. Maybe some of the
MVPs will have a suggestion. I have a lot of experience with Access, but I
don't know as much as some of the more expert-level people who post here.
Sorry I can't give you any more suggestions (other than re-installing Access!)
.

Hi again

Yes i've tried that even did a rebuild and then re-created the module.

I also created a brand new database in access 2003 format imported the
object, compacted and repaired. Created the sub, compacted and repaired and i
still get it crashing.

I don't understand it at all, i'm used to building large multi-user
databases and this one is tiny and simple and doesn't even have a security
system yet and it crashes constantly.

Gillian
Did you try my suggestion of copying the sub code, deleting the sub and rec-
creating it? I've had that work before when I've had a corrupted DB.
[quoted text clipped - 17 lines]
 
J

JimBurke via AccessMonster.com

Well we're on the same page with all the various potential solutions anyway -
just reading the wrong book I guess! Good luck. Hope you find an answer, and
I'll be curious to see what it is.
Thanks for all of your help. I'll try reposting with a general problem.

I have actually already tried re-installing access, which didn't work. I
then tried re-installing the whole office suite and still no difference.

Gillian
I don't know, maybe it's Access itself that has a problem - that's about the
only thing I can think of. You might want to re-post here and rather than
[quoted text clipped - 25 lines]
 

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