 |
 |
Writing to an Access DB
|
 |
|
 |
|
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status:
Offline
|
|
I am trying to create an online survey that will submit to an MS Access database.
To stiffle the groans: I work for a non-profit agencey, with no tech people and no budegt to do anything other than an Access DB.
I developed some asp code to connect to the database. I can read records, but when I try to make changes using the recordset.update command, I get an error message stating that the DB is read only.
I cannot figure this one out. I called Dell (who hosts our website (again, don't get me started on that - I'm low man on the totum poll)) and they assured me that the DB is rwx, and that when the DSN was created it was not set to Read Only.
They told me the problem is probably in the Access DB itself. As I am not too familiar with Access this is very possible.
Can anyone give me some assistance here? I'd greatly appreciate it.
If you want to log in to the page and view it, please feel free to do so. Everything is in "test" mode, so there is no real data, only made up stuff so that I can test the system, therefore you can't mess anything up.
you can log in to the website using the l/p: Gerry/lawyer
the site is www.cnvs.org/surveypassword.asp
I can also send anyone who is willing/able to help me the actual ASP code.
Also: if you do log in to view the site, it is not set up to give you error or confirmation messages, so the only way you can really tell if your data was saved is by logging out and then logging in again and seeing if the changes took or not.
As I said, I keep getting an error that the DB is read only, I checked the properties of the file and this is not the case, also I checked to ensure that it is not in a folder that is read only, etc. etc.
Any help is greatly appreciated!
Thank you,
O
B unce!
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Dec 2002
Status:
Offline
|
|
I know you probably can't do anything about it now, but if you have a low budge MySQL is FREE! So is PHP, Apache.. Anyway, sorry to waste the post because I can't help you. I know how to build access databases but not much about access queries.
Travis
forté web design
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2001
Location: somewhere
Status:
Offline
|
|
I'd be happy to look at the code.
How are you opening your recordset?
You want to check your locktype and your cursor type. Many examples of ASP code will use adOpenForwardOnly and adLockReadOnly, like this:
rsItems.Open sql, strConnect, adOpenForwardOnly, adLockReadOnly
Try this instead:
rsItems.Open sql, strConnect, adOpenKeyset, adLockPessimistic
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status:
Offline
|
|
are you getting an 'operation needs an updateable query' error (or something similar)?
If so, you need to set the permissions of the enclosing directory to read+write. Right click on the folder the database is in, go to Properties > Security > and click on the Permissions button. Make sure "Everyone" has "read and write" access.
Let me know if this fixes it. BTW ASP is my forte. I'd be happy to help you with any coding help you need.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status:
Offline
|
|
Well, I figured out the problem...I got the darn thing to work on our server, so I think Dell LIED to me, and the permissions are not properly set on thier server.
However, in the process of being able to write, I encountered a new error. Let me explain what I am trying to do, and that might help you in assisting me...
I am creating a survey...it's very long, so the goal is to make it so that a person can complete part of it, save it, come back make changes, etc. etc.
The new error I get is:
Technical Information (for support personnel)
* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Field 'General.person' cannot be a zero-length string.
/brian/testshort.asp, line 82
Basically, it won't let me leave a field blank.
How can I get it to allow me to leave a field blank, so that if a person wants to answer question 2 and 3 but not 1 and 4 (for example) they can do so, save, and later come back and answer 1 & 4.
Thank you,
O
B unce!
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2001
Location: somewhere
Status:
Offline
|
|
Look in the Table Designer for that field and check if there are any Validation Rules or if Required is set to Yes.
An alternative is to put a space (" ") into the field.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Oct 2001
Location: PA
Status:
Offline
|
|
Originally posted by wallinbl:
An alternative is to put a space (" ") into the field.
Avoid this if you can, better to make sure that the field is not required in table design mode. I suggest this because it is sometimes helpful to search for all records where a field is null, having an empty space will turn the field into Is Not Null.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: May 2001
Location: Nottingham, UK
Status:
Offline
|
|
Originally posted by NDBounce:
Technical Information (for support personnel)
* Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Field 'General.person' cannot be a zero-length string.
/brian/testshort.asp, line 82
To solve this, open the table up in Design view. Click on the field, and set the "allow zero length" option to Yes.
I set up all my tables with this set to yes as default, to avoid these annoying errors.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2001
Location: somewhere
Status:
Offline
|
|
Originally posted by ringo:
I suggest this because it is sometimes helpful to search for all records where a field is null, having an empty space will turn the field into Is Not Null.
SELECT * FROM Table WHERE RTRIM(Col) = ''
I hate NULLs. They create annoying situations in code because they cause errors in many languages when you try to operate on them. I much prefer default values ('' or 0).
|
|
|
| |
|
|
|
 |
|
 |
|
Mac Elite
Join Date: Mar 2001
Location: England
Status:
Offline
|
|
I hate Access. I'm having to use it for the first time to do my Computer Science project . Visual Basic and Access are the set requirements... nothing I can do. Teacher's a Mac user too (I converted him, after showing him music production on one) but he doesn't have any authority to change the syllabus... and the school computers are still PCs except in the Art/Design lab.
I come from a PHP/MySQL background, and trying to get my head round the recordset/data pointer stuff in VB/Access is a nightmare. It just doesn't make logical sense to me at all... MySQL seems a whole lot simpler.
Amorya
|
|
What the nerd community most often fail to realize is that all features aren't equal. A well implemented and well integrated feature in a convenient interface is worth way more than the same feature implemented crappy, or accessed through a annoying interface.
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Dec 2002
Status:
Offline
|
|
Hah, good luck converting the Com. Sci. dept to Macs! lol, the CS dept here despise my mac. But hey, I'm getting better grades than all those PC users  I have Apache 1.3, MySQL, and PHP4 running on my computer. MySQL is sort of confusing, but I'm understanding it better. Plus, phpMyAdmin makes it simple. In-Terminal MySQL still bothers me though.
|
|
|
| |
|
|
|
 |
|
 |
|
Professional Poster
Join Date: Dec 2001
Location: somewhere
Status:
Offline
|
|
Originally posted by Amorya:
I come from a PHP/MySQL background, and trying to get my head round the recordset/data pointer stuff in VB/Access is a nightmare. It just doesn't make logical sense to me at all... MySQL seems a whole lot simpler.
Amorya
I've used both, and can't really say that I prefer either. If you work with VB directly inside Access, the code is bizarre. If you just use VB6 and ADO, it's pretty straightforward. There are even a few nice features in there. The problem I have seen is that so many books (and online examples) have some of the most contorted ways to open and process a recordset that I have ever seen.
|
|
|
| |
|
|
|
 |
|
 |
|
Senior User
Join Date: Feb 2000
Location: Webster, NY, USA
Status:
Offline
|
|
Originally posted by derbs:
To solve this, open the table up in Design view. Click on the field, and set the "allow zero length" option to Yes.
I set up all my tables with this set to yes as default, to avoid these annoying errors.
Here's the deal, I have 500 fields (5 tables, each with roughlt 100 fields), and changing each one manually will take forever and a day. Is there an easy way to change all the fields to allow them to allow zero length? How do you set this as your default?
If I can set that as the default, I imagine that I can export the tables to excel and then reimport them with the default setting allowing zero length fields.
Again, all help is greatly appreciated.
O
B unce!
|
|
|
| |
|
|
|
 |
 |
|
 |
|
|
|
|
|

|
|
 |
Forum Rules
|
 |
 |
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
 |
 |
 |
 |
|
 |
|