Hello,
I am creating my project now and I am using Dreamweaver CS3 ASP VBScript and Access 2007.

Can you teach me how to restrict the database to add only three records on the table;
say, a student has a MemberNo and he can only use his MemberNo to borrow books three times;

And if the data is already inserted three times, a message will popup or appear saying,
"You have reached the limit of borrowing books"
I wonder where should I do that? In Access or Dreamweaver?

You can simply create a column named say 'BorrowCount' and let the initial value be zero(0). Once there's a new entry from the user, this value can be incremented by one and once it gets to three, you can provide your error message. Note that this would require your application querying the database to get the latest number of times the user has borrowed books on any new entry.

Thank you so much Netcode for posting your reply. I got your idea. Btw what do you mean by "Note that this would require your application querying the database to get the latest number of times the user has borrowed books on any new entry."? How can i do that?

he means you need to query first and get the value of borrowcount before you proceed on inserting new records.

this is how i see it

sql = "select borrowcount from table"

if borrowcount <= 3 then

sql = "insert into ***********"

else

'alert the user

end if

if you want you don't need to add another column for borrow count, just query first using "select count as borrowcount from table where *****", from there you can get the number of records.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.