Source language: Translate to:

Saving record to database

Questions about our Advanced Database plug-in

Moderator: Neosoft Support

Saving record to database

Postby mejiag » Mon Nov 10, 2008 1:28 pm

Hello, Neosoft support team,

I am new to Neobook and dbp plugin, and I am having difficulties saving a record to a database that already exists. Here is the code I have written:

dbpOpenDatabase "DB" "N:\collections$\SpanGenEd\GenEdAssmnt.mdb"
dbpOpenTable "DB" "112" ""
setvar "[DB.112.$Language]" "Spanish"
setvar "[DB.112.$Form]" "A"
setvar "[DB.112.$YearOfTest]" "[Year]"
dbpAddRecord "DB" "112"

The program runs, but does not save anything to the database.

what is missing?

Thank you in advance for any help you can give.
Sorry if this message is sent to the forum twice. I don't know what I am doing...
mejiag
 
Posts: 14
Joined: Mon Nov 10, 2008 1:08 pm

Postby Leos » Mon Nov 10, 2008 2:01 pm

Hi,


it looks like you hava an MS access database, so you must change:
dbpOpenTable "DB" "112" ""

to

dbpOpenAccessTable "DB" "112" ""



you must first to add the record, :

dbpAddRecord "DB" "112"

and after to add record data

setvar "[DB.112.$Language]" "Spanish"
setvar "[DB.112.$Form]" "A"
setvar "[DB.112.$YearOfTest]" "[Year]"

Confirm that database dbpsetautoedit is turned on (true)

You can save data manually by:

dbpSaveEdits "DB" "112"
User avatar
Leos
 
Posts: 178
Joined: Mon Apr 04, 2005 11:13 am
Location: Coimbra, Portugal

Postby Gaev » Mon Nov 10, 2008 2:12 pm

mejiag:

a) Was this Database and Table created first ? ... either by you or some other Application ?

b) Are the fields in Table named 112 called $Language, $Form and $YearOfTest ? ... not sure how MS Access reacts to field names with a $ sign ... if you created this database, try using field name that start with an alphabetic ... and the rest of the characters are alphanumeric or the underscore character only.

c) Check the contents of the first record in the Table ... perhaps this is where all the updates are ending up ... read the Help file for NeoBookDBPro ... section called Working With Data ... to understand how the fields in the (current) record interact with NeoBook variables ... you might then try doing the dbpAddRecord first ... then the SetVar commands ... and perhaps the dbpSaveEdits command.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Saving record to database

Postby mejiag » Mon Nov 10, 2008 2:22 pm

Thank you very much for your response. I will try that.
mejiag
 
Posts: 14
Joined: Mon Nov 10, 2008 1:08 pm


Return to NeoBookDBPro

Who is online

Users browsing this forum: No registered users and 1 guest