473,386 Members | 1,702 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

MS Access [Form] and vb Code

Dear All
How are, I am new memeber to your comunuity.
i have built s small database to check out books
two tables have been created
Books and Students
Books have B-Id and Status
Student Have name,id and book tag
andf one query that has book tage and stauts is check to true
Book tage gets its info from book table where the realation is 1 to M
i created a form using wizerd
i creatd a button called check out , where i code the follwing

Private Sub CheckOut_Click()

Dim temp
Dim strSQL As String
temp = Forms!students.LaptopTag
strSQL = "UPDATE Book SET Book.[Status-Av] = False, book.TagNumber = '" & temp & "';"

DoCmd.RunSQL strSQL
Refresh



End Sub

But i ge an error from access saying the following
microsoft can not update all the record in the query
key vailoation ,conversion faliure,lock vaiolation
Dec 1 '07 #1
2 1611
Dököll
2,364 Expert 2GB
Dear All
How are, I am new memeber to your comunuity.
i have built s small database to check out books
two tables have been created
Books and Students
Books have B-Id and Status
Student Have name,id and book tag
andf one query that has book tage and stauts is check to true
Book tage gets its info from book table where the realation is 1 to M
i created a form using wizerd
i creatd a button called check out , where i code the follwing

Expand|Select|Wrap|Line Numbers
  1. Private Sub CheckOut_Click()
  2.  
  3. Dim temp
  4. Dim strSQL As String
  5. temp = Forms!students.LaptopTag
  6. strSQL = "UPDATE Book SET Book.[Status-Av] = False, book.TagNumber = '" & temp & "';"
  7.  
  8.     DoCmd.RunSQL strSQL
  9.     Refresh
  10.  
  11.  
  12.  
  13. End Sub
  14.  
  15.  
But i ge an error from access saying the following
microsoft can not update all the record in the query
key vailoation ,conversion faliure,lock vaiolation
I am going to first add to Access forum for you, I think you'll get added support there.

Also, is temp the same data format as TagNumber
Dec 2 '07 #2
ADezii
8,834 Expert 8TB
I am going to first add to Access forum for you, I think you'll get added support there.

Also, is temp the same data format as TagNumber
Expand|Select|Wrap|Line Numbers
  1. Private Sub CheckOut_Click()
  2. Dim temp As String
  3. Dim strSQL As String
  4.  
  5. temp = Forms!students.LaptopTag
  6.  
  7. If Not IsNull(temp) Then
  8.   strSQL = "UPDATE Book SET Book.[Status-Av] = False Where Book.TagNumber = '" & temp & "';"
  9.  
  10.   DoCmd.RunSQL strSQL
  11.   Me.Refresh
  12. End If
  13. End Sub
Dec 2 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Manuel Lopez | last post by:
I have a puzzling form timer problem that I didn't experience prior to Access 2003 (though I'm not sure access 2003 is to blame). Here's the situation: a computer has two access 2003 databases on...
49
by: Yannick Turgeon | last post by:
Hello, We are in the process of examining our current main application. We have to do some major changes and, in the process, are questionning/validating the use of MS Access as front-end. The...
20
by: Olav.NET | last post by:
I am a .NET/C++ developer who is supposed to do some work with Access. I do not know much about it except for the DB part. Questions: *1* I am looking for INTENSIVE books to get quickly up to...
42
by: lauren quantrell | last post by:
So many postings on not to use the treeview control, but nothing recently. Is it safe to swim there yet with Access 2000-Access 2003?
55
by: AnandaSim | last post by:
I just had a google through this NG but have not seen mention of Erik Rucker's blog entry and the new Jet: http://blogs.msdn.com/access/archive/2005/10/05/477549.aspx mentioned by Mike...
34
by: Mathieu Trentesaux | last post by:
Hello I downloaded Office 2007 for this reason : It seems, once again, that it is impossible to save any modification done in a VBA library, from the main project in Access. The save button...
2
by: rdemyan via AccessMonster.com | last post by:
I have a custom message form that I want to display when the user shuts down my app. Some clean up needs to be done during shutdown and I want to display this form and then display various...
14
by: ApexData | last post by:
I am considering building some distributable commercial applications. For about a year now, I have been using Access2000. This was my first venture into object oriented database development. ...
16
by: John | last post by:
I am looking for VBA code that will work with Access 2003 to enable dragging and dropping a file/folder name from Windows XP Explorer into an Access form's text box. This is a common functionality...
2
hyperpau
by: hyperpau | last post by:
Before anything else, I am not a very technical expert when it comes to VBA coding. I learned most of what I know by the excellent Access/VBA forum from bytes.com (formerly thescripts.com). Ergo, I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.