By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,404 Members | 2,300 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,404 IT Pros & Developers. It's quick & easy.

Event procedure closes database unexpectedly?!?! I tried removing...but!

imrosie
100+
P: 222
Hello all,

I have several of the following on my Customer form to populate the 'shipping' controls (ship addr, ship name, shipstate ect.)....

Private Sub BillingAddress_AfterUpdate()
Me!ShipAddress = Me!BillingAddress
End Sub

What happened is (not sure) when I was adding another procedure, somehow I would get this message with a gray highlight (in VB) over the 'End Sub', stating "Only comments are allowed after subroutine"... That confused me(yes, newbie,self-taught). When I looked at the helps it appears that somehow I must have put it inside of another procedure. So I cut out 2 procedures, which must have been a no - no. So now when I try to add them back, I go into the control, select 'after update', then I select code builder as soon as I click, the entire db blows away. I don't know what's corrupt, because everything works great until I get to these two. How do I repair? thanks.

Rosie
Jun 8 '07 #1
Share this Question
Share on Google+
4 Replies


MSeda
Expert 100+
P: 159
if you have a backup of your database from before the corruption. delete the form from your current database and import it from the older file. see if that stops the wierdness. If that doesn't work (or you don't have a backup) try recreating the form in question from scratch.
If you haven't already compile your code when you get the offending bits removed.
Jun 9 '07 #2

ADezii
Expert 5K+
P: 8,638
Hello all,

I have several of the following on my Customer form to populate the 'shipping' controls (ship addr, ship name, shipstate ect.)....

Private Sub BillingAddress_AfterUpdate()
Me!ShipAddress = Me!BillingAddress
End Sub

What happened is (not sure) when I was adding another procedure, somehow I would get this message with a gray highlight (in VB) over the 'End Sub', stating "Only comments are allowed after subroutine"... That confused me(yes, newbie,self-taught). When I looked at the helps it appears that somehow I must have put it inside of another procedure. So I cut out 2 procedures, which must have been a no - no. So now when I try to add them back, I go into the control, select 'after update', then I select code builder as soon as I click, the entire db blows away. I don't know what's corrupt, because everything works great until I get to these two. How do I repair? thanks.

Rosie
This Error Message appears when you inadvertantly add an additional End Sub or End Function line at the end of either one of these Procedures. Check for double entries, suc as:
Expand|Select|Wrap|Line Numbers
  1. End Sub
  2. End Sub
  3.  
OR
Expand|Select|Wrap|Line Numbers
  1. End Function 
  2.  
  3. End Function
Jun 9 '07 #3

imrosie
100+
P: 222
This Error Message appears when you inadvertantly add an additional End Sub or End Function line at the end of either one of these Procedures. Check for double entries, suc as:
Expand|Select|Wrap|Line Numbers
  1. End Sub
  2. End Sub
  3.  
OR
Expand|Select|Wrap|Line Numbers
  1. End Function 
  2.  
  3. End Function
You're so right....but I checked that first and nope, there weren't any of those...I do have a back up as the first reply suggested...so I think I'd better give that a try,

thanks for your suggestion.
Jun 9 '07 #4

imrosie
100+
P: 222
if you have a backup of your database from before the corruption. delete the form from your current database and import it from the older file. see if that stops the wierdness. If that doesn't work (or you don't have a backup) try recreating the form in question from scratch.
If you haven't already compile your code when you get the offending bits removed.
Thanks MSeda,

I do have a backup, so I'll start there. I really hope I don't have to start from scratch....this has been a journey for a newbie. thahks for the suggestion.

Rosie
Jun 9 '07 #5

Post your reply

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