Compile Error (1 Viewer)

amiscus

Registered User.
Local time
Today, 12:26
Joined
Jul 7, 2009
Messages
13
When I try to add a button to a form I get the follwoing error.

Compile error. in query expression 'AppLoadString([bw_tblBtnActions].[Description])'

I have other forms with buttons on them that jsut open reports. When I click any of them I get this next error.

Compile error: Invalid outside procedure

And i get taken to a VBA module that says the following

Option Compare Database
Option Explicit
SQLcode = "alter table pipe hsit add column Number counter(1,1);"
DoCmd.RunSQL SQLcode
Sub number()
End Sub

This is all greek to me. I treid to check the database references and none are missing. I also tried unchecking and rechecking the others but to reload the references but that had no effect as well. Is there some other reference i should add? My old database copies seem to work all right and they have the same references. If anyone ahs some ideas please let me know. Thanks.
 

MSAccessRookie

AWF VIP
Local time
Today, 12:26
Joined
May 2, 2008
Messages
3,428
When I try to add a button to a form I get the follwoing error.

Compile error. in query expression 'AppLoadString([bw_tblBtnActions].[Description])'

I have other forms with buttons on them that jsut open reports. When I click any of them I get this next error.

Compile error: Invalid outside procedure

And i get taken to a VBA module that says the following

Option Compare Database
Option Explicit
SQLcode = "alter table pipe hsit add column Number counter(1,1);"
DoCmd.RunSQL SQLcode
Sub number()
End Sub

This is all greek to me. I treid to check the database references and none are missing. I also tried unchecking and rechecking the others but to reload the references but that had no effect as well. Is there some other reference i should add? My old database copies seem to work all right and they have the same references. If anyone ahs some ideas please let me know. Thanks.

I am not sure what the intention of the code is, but it appears to be out of order. Try the following instead:
Code:
Option Compare Database
Option Explicit
Sub number()
    SQLcode = "alter table [pipe hsit] add column Number counter(1,1);"
    DoCmd.RunSQL SQLcode
End Sub

Note that the "[" and "]" characters have been added around "pipe hsit" on the assumption that "pipe hsit" was the name of the Table being altered. If this is not the case, then that part of the code will need to be modified,
 

amiscus

Registered User.
Local time
Today, 12:26
Joined
Jul 7, 2009
Messages
13
I tried adding the bracekts but it still returns the errors. The weird thing is that pipe hsit is an old table I had that was renamed and then deleted. I don't understand why thre would be any references to it since the form and report and the new table and the new queries were all created after it was deleted.
 

MSAccessRookie

AWF VIP
Local time
Today, 12:26
Joined
May 2, 2008
Messages
3,428
I tried adding the bracekts but it still returns the errors. The weird thing is that pipe hsit is an old table I had that was renamed and then deleted. I don't understand why thre would be any references to it since the form and report and the new table and the new queries were all created after it was deleted.

If the table has been replaced in the database, then it probably needs to be replaced in this Query as well. The Alter command requires the table to exist inthe database before it can be executed.
 

amiscus

Registered User.
Local time
Today, 12:26
Joined
Jul 7, 2009
Messages
13
It has been replaced. All of the queries were built with the new table that is named "pipeline historical." I have no idea were the references to the old table came from and I get the same error from forms that were built before this newest form.
 

boblarson

Smeghead
Local time
Today, 09:26
Joined
Jan 12, 2001
Messages
32,059
Note that this:

Code:
Option Compare Database
Option Explicit
SQLcode = "alter table pipe hsit add column Number counter(1,1);"
DoCmd.RunSQL SQLcode
Sub number()
End Sub

is not within a sub. The Option Explicit and Option Compare Database are where they should be but there is something in the wrong place (see red):

Code:
Option Compare Database
Option Explicit
[COLOR="red"]Sub number()[/COLOR]
[COLOR="red"]Dim SQLcode As String[/COLOR]
SQLcode = "alter table pipe hsit add column Number counter(1,1);"
DoCmd.RunSQL SQLcode
End Sub

Second, the alter table statement seems off.
 

MSAccessRookie

AWF VIP
Local time
Today, 12:26
Joined
May 2, 2008
Messages
3,428
It has been replaced. All of the queries were built with the new table that is named "pipeline historical." I have no idea were the references to the old table came from and I get the same error from forms that were built before this newest form.

Can you show the revised Query? And I agree with Bob Larson that the Alter Table Statement looks like it has a non-Access Syntax. Perhaps it was based on Oracle or SQL Server?
 
Last edited:

amiscus

Registered User.
Local time
Today, 12:26
Joined
Jul 7, 2009
Messages
13
Thanks for the help from eveyone but i just ended up importing all the new tables queries forms and reports in to an older, stable version of the database. Still don't know what was causing the error because everything works fine in the new combined version. Maybe some weird corruption issue.
 

MSAccessRookie

AWF VIP
Local time
Today, 12:26
Joined
May 2, 2008
Messages
3,428
Thanks for the help from eveyone but i just ended up importing all the new tables queries forms and reports in to an older, stable version of the database. Still don't know what was causing the error because everything works fine in the new combined version. Maybe some weird corruption issue.

Unless of course, there is an intermittant problem with the Query that you were originally asking about. If that is the case, then it is possible that the problem will return again at some time in the future. Until then, good luck with your work.
 

Cam D

New member
Local time
Today, 09:26
Joined
Jul 1, 2009
Messages
8
my problem is that when i try to make a button it comes up with the same error messages as the OP then when i use the button it closes the form and opens VBA but with relationships it highlights onetomany.
 

boblarson

Smeghead
Local time
Today, 09:26
Joined
Jan 12, 2001
Messages
32,059
my problem is that when i try to make a button it comes up with the same error messages as the OP then when i use the button it closes the form and opens VBA but with relationships it highlights onetomany.
What code is highlighted?
 

Cam D

New member
Local time
Today, 09:26
Joined
Jul 1, 2009
Messages
8
the whole code was allrelationships=onetomany but the highlighjted code was just onetomany
 

boblarson

Smeghead
Local time
Today, 09:26
Joined
Jan 12, 2001
Messages
32,059
the whole code was allrelationships=onetomany but the highlighjted code was just onetomany

That response doesn't make sense to me. Are you saying you had a line of code which reads:

allrelationships=ontomany

in your VBA code? If so, I'm not surprised it errored there as that has no meaning at all, at least I can see none since you've provided no code whatsoever. How about posting the code you have and then highlighting the spot it throws the error.
 

Cam D

New member
Local time
Today, 09:26
Joined
Jul 1, 2009
Messages
8
the code was pre-made when i created the relationship the error appeared when i tried to use a button i made on a form.
 

boblarson

Smeghead
Local time
Today, 09:26
Joined
Jan 12, 2001
Messages
32,059
the code was pre-made when i created the relationship the error appeared when i tried to use a button i made on a form.

I'm guessing that English is not your native language, correct? (due to the very short responses here).

Can you post your database? It might clear up many things.

Go here to find out how to post it.
 

Cam D

New member
Local time
Today, 09:26
Joined
Jul 1, 2009
Messages
8
english is my native language, the reason i didn't post long sentences is because it wasn't required, i only posted what was needed.

anyway this is my database open the "member details" form and click on the button that says "save and exit" and the error should appear.
 

Attachments

  • film club management database.zip
    38.5 KB · Views: 110

boblarson

Smeghead
Local time
Today, 09:26
Joined
Jan 12, 2001
Messages
32,059
Go to the module and remove this line of code (which doesn't make sense anyway):

allrelationships = onetomany

pull it out, get rid of it. It does nothing but throw the error.
 

Users who are viewing this thread

Top Bottom