Source language: Translate to:

help with dbpOpenTable Error

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

help with dbpOpenTable Error

Postby BRobinsonS » Tue Sep 14, 2010 5:12 pm

I just purchased the NeoBookDBPro today so might be doing something wrong here.

I have created a Access database called product and created a table called product in that database.

I am trying the following actions:

dbpOpenAccessDatabase "products" "C:\Users\Thomas\Documents\NeoBook 5\ShopSiteDB\product.mdb" ""
dbpOpenTable "products" "product" ""

The database opens and I see the fields get populated by the data from the first record, but get a error stating the Table product could not be opened. I also get the same message if I try and click the database navigation buttons.

Any Suggestions?

Thanks,
Tom
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby BRobinsonS » Wed Sep 15, 2010 5:39 am

After creating a database with just the fields I was able to open the database and table.

Now when I try to work with my data I get a Record to big large error.
My database is 2500 records and I seem to be able to import 788.

I am using:

dbpOpenDatabase "products" "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=[PubDir]ShopSiteDB.mdb;CursorLocation=Server"
dbpOpenTable "products" "products" ""
dbpShowGrid "products" "products" "Grid_products"

Any Ideas why it would not see all my records?
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby Neosoft Support » Wed Sep 15, 2010 10:42 am

NeoBookDBPro should be able to open any valid MS Access database. In fact, we haven't found any MS Access databases that couldn't be opened with DBPro - even extremely large ones. Most likely what's happening is that the table contained within the Access mdb file is actually named something other than "product".

Try using the following to retrieve a list of table names from your database:

Code: Select all
dbpOpenAccessDatabase "products" "C:\Users\Thomas\Documents\NeoBook 5\ShopSiteDB\product.mdb" ""
dbpGetTableNames "products" "[#13]" "[TableList]"
AlertBox "" "[TableList]"


See if the names of the tables displayed are different than you thought they were.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby BRobinsonS » Thu Sep 16, 2010 7:47 pm

I created a new Database called product.mdb


Ran this code:

dbpOpenAccessDatabase "product" "C:\Users\Thomas\Documents\NeoBook 5\ShopSiteDB\product.mdb" ""
dbpGetTableNames "product" "[#13]" "[TableList]"
AlertBox "" "[TableList]"

Resulted with alertbox with product listed as the table found


Ran this code:

dbpOpenTable "product" "product" ""

Resulted in error The Table product could not be opened
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby Gaev » Fri Sep 17, 2010 4:58 am

tom0360:

In all your postings, I do not see where you create a Table (see dbpCreateTable).

Perhaps, when there are no tables defined within a Database, dbpGetTableNames returns the name of the Database (or some dummy/temporary Table with the same name as the "Database id".

If you did create a Table ... please copy/paste the exact command from your pub.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby Neosoft Support » Fri Sep 17, 2010 10:29 am

This seems to work fine for me:

Code: Select all
dbpCreateAccessDatabase "[PubDir]product.mdb" "Password=;Encrypted=No"
dbpOpenAccessDatabase "product" "[PubDir]product.mdb" ""
dbpCreateTable "product" "product" "LastName String(35);FirstName String(35);Street String(100);City String(35);State String(2);ZipCode String(10)"
dbpOpenTable "product" "product" ""


Did you create your database with DBPro or some other application?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby BRobinsonS » Wed Sep 22, 2010 9:53 am

Would I need to use dbpCreateTable when opening a Microsoft Access Database with a table already in it?


Thanks,
Tom
User avatar
BRobinsonS
 
Posts: 337
Joined: Sun Sep 25, 2005 9:00 pm
Location: Ontario, Canada

Postby Neosoft Support » Wed Sep 22, 2010 10:16 am

Would I need to use dbpCreateTable when opening a Microsoft Access Database with a table already in it?


No, if the table already exists then you should only need to use dbpOpenAccessDatabase and dbpOpentable.

Can you tell us what version of Access was used to create the database?

What version of Windows are you using?

Can you provide us with a copy of your database (or a similar one) for testing?
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smokinbanger » Wed Feb 22, 2012 7:55 pm

I'm having this same problem except I'm using a table named History. I've rechecked spelling and everything and can't seem to get it to work. Any suggestions? The first table (Address Book) opens fine but not the second one.
I get the same error: The Table History could not be opened.
However when I check the variable in the debugger is shows
Code: Select all
Runners.$Status:Connected
Runners.Address Book.$State:Browse
Runners.History.$State:Browse

Here is the code to open it:
Code: Select all
dbpOpenAccessDatabase "Runners" "[DataPath]RFCDB.rfcdb" "Password=rfcdb"
dbpOpenTable "Runners" "Address Book" ""
dbpOpenTable "Runners" "History" ""


And here is the code I used to create the DB and tables:
Code: Select all
FileExists "[DataPath]RFCDB.rfcdb" "[FileExists]"
If "[FileExists]" "=" "True"
ClearVariables "[FileExists],[FolderExists]"
Return
EndIf


Suspend "True"
:LineCreateDB
dbpCreateAccessDatabase "[DataPath]RFCDB.rfcdb" "Password=rfcdb;Encrypted=No"


dbpOpenAccessDatabase "Runners" "[DataPath]RFCDB.rfcdb" "Password=rfcdb"
:LineCreateAB
dbpCreateTable "Runners" "Address Book" "[#34]CUSTOMER NAME[#34] String(35);ADDRESS String(35);[#34]ADDRESS 2[#34] String(35);CITY String(25);STATE String(2);ZIP String(10);PHONE String(12);EMAIL String(50)"
dbpTableExists "Runners" "Address Book" "[TableExists]"
If "[TableExists]" "=" "False"
GotoLine "LineCreateAB"
EndIf
:LineCreateHistory
dbpCreateTable "Runners" "History" "TRACKING String(20);[#34]DATE CREATED[#34] String(10);[#34]TIME CREATED[#34] String(11);[#34]REFERENCE 1[#34] String(20);[#34]REFERENCE 2[#34] String(35);CUSTOMER String(35);ADDRESS String(35);[#34]ADDRESS 2[#34] String(35);CITY String(25);STATE String(2);ZIP String(10);PHONE String(12);ATTN String(35);[#34]SPECIAL INSTRUCTIONS[#34] Memo;[#34]CREATED BY[#34] String(35);[#34]CALL TAG[#34] Boolean Default=False;[#34]ITEM DESCRIPTION[#34] Memo;[#34]PACKAGE COUNT[#34] String(2);WEIGHT String(4);COD Boolean Default=False;[#34]COD AMOUNT[#34] Integer;[#34]TOTAL CHARGES[#34] Integer;VOIDED Boolean Default=False;[#34]PICKED UP[#34] Boolean Default=False"
dbpTableExists "Runners" "History" "[TableExists]"
If "[TableExists]" "=" "False"
GotoLine "LineCreateHistory"
EndIf

Suspend "False"

ClearVariables "[TableExists]"
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Postby Neosoft Support » Thu Feb 23, 2012 10:58 am

Try using a table name other than "History" and see if that makes any difference.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby smokinbanger » Thu Feb 23, 2012 11:33 am

I tried using "Shipping History" but got the same results.
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Postby Gaev » Thu Feb 23, 2012 1:16 pm

You might check (dbpGetTableNames) to see if the Tables already exist ... might be balking because a Table with the same name exists.

Otherwise, sadly the only approach to such problems is to take it one step at a time ... until it stops working.

a) Use Table Name of 'ShippingHistory' ... no spaces ... with just one String field (again, no spaces)

b) then add one Integer field (no spaces) ... followed by one each of Boolean and Memo fields (yes, no spaces)

c) then add remaining String fields ... followed by remaining fields of the other types

You might even try doing all this in a test pub/database ... with just the dbpCreateTable command linked to a Button ... no other commands or loop backs.

Then post your results here.

Also, if you can confirm that the code you posted was copied/pasted from the pub exactly as it appears, I can try out the dbpCreatetable command on my machine with the same Table and Field names.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby smokinbanger » Thu Feb 23, 2012 5:08 pm

IT'S THE MEMO FIELD!
I had 2 fields that were a "Memo" type field. When I changed them to a string then BINGO! :D It works just fine! Having a "space" in the table name OR field name made NO difference but changing the memo fields to a string fixed the problem. The tables were getting created properly, I would open them with MS Access to verify. It's just that the DBpro plugin or the dbpOpenTable command doesn't like the memo fields. Maybe support can look in to this and see why? :idea:

Thanks Geav! After reading your post I suspected it was the memo field because I had already tried different names with no spaces...
smokinbanger
 
Posts: 198
Joined: Mon Jan 16, 2012 9:53 am
Location: United States

Postby Neosoft Support » Fri Feb 24, 2012 11:15 am

Actually, it appears to be the spaces in your field names. With the spaces, the History table is not created. With the spaces removed, it will be created correctly. For example:

Code: Select all
dbpCreateTable "Runners" "History" "TRACKING String(20);DATECREATED String(10);TIMECREATED String(11);REFERENCE1 String(20);REFERENCE2 String(35);CUSTOMER String(35);ADDRESS String(35);ADDRESS2 String(35);CITY String(25);STATE String(2);ZIP String(10);PHONE String(12);ATTN String(35);SPECIALINSTRUCTIONS Memo;CREATEDBY String(35);CALLTAG Boolean Default=False;ITEMDESCRIPTION Memo;PACKAGECOUNT String(2);WEIGHT String(4);COD Boolean Default=False;CODAMOUNT Integer;TOTALCHARGES Integer;VOIDED Boolean Default=False;PICKEDUP Boolean Default=False"


You can probably get away with using spaces in MS Access, but DBPro isn't MS Access. If you use spaces, then some functions won't work correctly.
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest