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

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

imrosie
222 100+
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
4 1224
MSeda
159 Expert 100+
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
8,834 Expert 8TB
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
222 100+
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
222 100+
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

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

Similar topics

4
by: Niel | last post by:
Hello friends, I am not sure if i am posting to the correct group but if anyone has an idea about this and the possible solution or the link to that solution then please let me know We have out...
4
by: Bill Manring | last post by:
I need to capture the event when the user closes the browser in my application. I have some code in the session_End event, which works fine when the session times out, but I need to end the...
5
by: AP | last post by:
IS there a way to run a procedure if the users close access directly rather than closing a menu screen that I have built? There is an event that works on close for this form, but it doesnt seem to...
2
by: BrianHIckman | last post by:
MY MS Access application, all code in VBA, suddenly closes unexpectedly when attempting to open a specific form which contains combos and standard fields, fed by qry A which in turn calls qryB. I...
15
by: mlcampeau | last post by:
Does anyone know why my database sometimes closes on its own for no apparent reason? I don't think it has anything to do with my code because, as an example of when it closed on me, I was entering...
0
MMcCarthy
by: MMcCarthy | last post by:
VBA is described as an Event driven programming language. What is meant by this? Access, like most Windows programs, is an event driven application. This means that nothing happens unless it is...
2
by: acw | last post by:
On a SQL Server 2000 db I would like to setup a stored procedure that accesses couple tables and runs the extended stored procedure xp..cmdshell. The goal is to grant users with limited privileges...
3
by: Johnson | last post by:
I'm not sure if this is an IIS 5.1 issue or ASP.NET issue, or Visual Studio 2008 issue -- thus posting to 3 groups. Please don't be offended. The problem I'm encountering is that Visual Studio...
7
by: Sheena777 | last post by:
How can i catch a close event on a web page without the use of javascript. I have a site that a users has to log in to and from that I have to keep track of if they are logged in or not. My problem...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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...

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.