Error Creating Table

Error Creating Table

Post by Sherif Raou » Wed, 28 Mar 2001 03:09:12



Hello everybody,
I have a problem here. I tried to create a table in a form with a public
variable called OfferName. Here is the code:
set cn = new ADODB.connection
cn.open "DSN=SALES"
set rs= new ADODB.Recordset
rs.ActiveConnection =cn
rs.Source = "Create table " & OfferName & " (offer_id integer, device_id
integer)"
rs.open
form2.show
form1.hide
set rs=nothing
cn.close
set cn.nothing

dim mydb as Database
dim myrs as Recordset
private sub form_load()
set mydb = OpenDatabase("SALES")
set myrs=mydb.openRecordset(form1.OfferName & ",dbOpenTable)
end sub

When I run this code a message saying that the path of the file is wrong
appears BUT when I debbug this code it runs fine...
Could anybody help me
Thank you in advance...

 
 
 

Error Creating Table

Post by Tom » Wed, 28 Mar 2001 15:05:54


I'm not sure exactly what is going on in your program without seeing it.
Have you verified for sure what line is failing?  If it is the OpenRecordset
line, it is possible that things are happening too quickly when you are
running the executable as opposed to when you are debugging.  Or perhaps the
compiler put some kind of "optimization" in the compiled code.

What I would do in a situation like this is to add a public property to
form2 that matches the property in form1 and get the value out of the
property on form1 and set another property on form2 with the value that you
got out of form1.

Like this:
form1.hide
strPropertyValue = form1.OfferName
set form1 = nothing

form2.OfferName = strPropertyValue
form2.show
set form2 = nothing

And in form2 I would have a property procedure rather than a public
variable.

Like this:
Property Let OfferName(ByVal vstrOfferName As String)
  mstrOfferName = vstrOfferName
  set mydb = OpenDatabase("SALES")
  set myrs=mydb.openRecordset(mstrOfferName, dbOpenTable)
End Property


> Hello everybody,
> I have a problem here. I tried to create a table in a form with a public
> variable called OfferName. Here is the code:
> set cn = new ADODB.connection
> cn.open "DSN=SALES"
> set rs= new ADODB.Recordset
> rs.ActiveConnection =cn
> rs.Source = "Create table " & OfferName & " (offer_id integer, device_id
> integer)"
> rs.open
> form2.show
> form1.hide
> set rs=nothing
> cn.close
> set cn.nothing


> dim mydb as Database
> dim myrs as Recordset
> private sub form_load()
> set mydb = OpenDatabase("SALES")
> set myrs=mydb.openRecordset(form1.OfferName & ",dbOpenTable)
> end sub

> When I run this code a message saying that the path of the file is wrong
> appears BUT when I debbug this code it runs fine...
> Could anybody help me
> Thank you in advance...


 
 
 

1. Error : create table statement is not allowed within trigger

What am I missing? I have a trigger for an insert and that
fires a stored procedure. The stored procedure fails in an
attempt to create a temporary table. The following error
is displayed.

The CREATE TABLE statement is not allowed within a
trigger.

In looking at books online, I do not see this as a illegal
command for a trigger. Is it illegal or is my syntax
invalid?

A section of the stored procedure is provided below.

Thanks in advance for any suggestions.

   CREATE PROCEDURE [SP_SEND_SCM_MAIL] AS
   BEGIN









   CREATE TABLE #texttab (
        Item varchar(50),
        ItemDescrption varchar(75),
        UnitPrice varchar(10),                  
        OrderQty varchar(10),          
        ItemTotalCost varchar(10))

2. JAM Report Writer ! Opinions Wanted !

3. Error creating tables with MS Access 2.0

4. select count(*) from ... puzzle

5. error creating table

6. Help!! Your user identifier was not known to this installation.

7. error creating table with vargraphic column -- please help!!!

8. create table or create trigger error

9. Creating a job in a trigger causes intermittent Can not CREATE TABLE error

10. error message: table or view existed when creating a table

11. Create table creates invisible table