473,387 Members | 1,535 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,387 software developers and data experts.

runtime error: you cannot add or change a record

140 100+
Hi

i am getting this kind of error

while saving the records this error comes.
runtime error:
you cannot add or change a record because a related record is required in table scene
Expand|Select|Wrap|Line Numbers
  1. Private Sub scenecbo_Click()
  2.  
  3. myconnection
  4.  
  5. myquery = scenecbo.Text
  6.  
  7. Call sceneLOAD
  8.  
  9.  MSaccs = "SELECT scene FROM scene WHERE sceneid =  '" & myquery & "' "
  10. 'Load SQL query into a variable
  11.  
  12. Set storyboard = CON.Execute(MSaccs, adOpenStatic)
  13.  
  14. End Sub
form load

Expand|Select|Wrap|Line Numbers
  1. Call sceneLOAD
  2. Do While Not storyboard.EOF
  3. scenecbo.AddItem storyboard!scene
  4. storyboard.MoveNext
  5. Loop
Expand|Select|Wrap|Line Numbers
  1. Sub sceneLOAD()
  2.  
  3. Set storyboard = New ADODB.Recordset
  4.  
  5. storyboard.Open "select * from scene ", CON, adOpenStatic, adLockReadOnly
  6.  
  7. End Sub
help me, i couldn't able to save the field.
Feb 8 '07 #1
4 1624
willakawill
1,646 1GB
Where are you saving a record in this code?
Feb 8 '07 #2
indhu
140 100+
Where are you saving a record in this code?
Expand|Select|Wrap|Line Numbers
  1. Private Sub cmdsave_Click()
  2.  
  3. If imagebox.Picture = LoadPicture("") Then
  4.     MsgBox "Please browse the image you want to add to your database.", vbExclamation, "Image required"
  5.     browseimage
  6.     Exit Sub
  7.  
  8. ElseIf Panelcombo = vbNullString Then
  9.  
  10.     MsgBox "Please provide panel number.", vbExclamation, "Panel field required"
  11.     Panelcombo.SetFocus
  12.      Exit Sub
  13. End If
  14.  
  15. 'Add mode only
  16. If addmode = True Then
  17. Randomize
  18. panelId_txt = Format(Round(Rnd() * 99999), "PAL00000")
  19.  
  20. Set storyboard = New Recordset
  21.     storyboard.Open "SELECT * FROM panel", CON, adOpenKeyset, adLockOptimistic
  22.     storyboard.AddNew
  23.     storyboard("episode") = episodecbo
  24.     storyboard("panelid") = panelId_txt
  25.     storyboard("panel") = Panelcombo
  26.     storyboard("filename") = Filename
  27.  'storyboard("scenes") = scenecbo i ve commented this becos of error
  28.     storyboard("sequence") = seqcombo
  29.     storyboard("action") = Action
  30.     storyboard("dialogue") = dialogue_txt
  31.     storyboard.Update
  32.  
  33.     SavePicture imagebox.Picture, App.Path & "\images\" & Filename
  34.  
  35.     question = MsgBox("Image saved to database. Do you want to add another image?", vbExclamation + vbYesNo, "Image saved")
  36.  
  37.       If question = vbYes Then
  38.         resetfields
  39.     Else
  40.         Unload Me
  41.     End If
  42. End If
  43. End Sub
  44.  
Feb 8 '07 #3
willakawill
1,646 1GB
And which part of this code fails?
Feb 8 '07 #4
indhu
140 100+
And which part of this code fails?


storyboard("scenes") = scenecbo
Feb 8 '07 #5

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

Similar topics

9
by: Marina Anufreichik | last post by:
Hi, After deploymnet web application on web server I can access page on local machine and login fine but when I'm trying to access web site from remote machine I can see login page, but when I'm...
3
by: windandwaves | last post by:
Hi, I am trying to make errors a bit more meaningful for my users. I am trying to fix error 3201 where there is a missing field in a form. If I do not do any error trapping, then I get ...
669
by: Xah Lee | last post by:
in March, i posted a essay “What is Expressiveness in a Computer Language”, archived at: http://xahlee.org/perl-python/what_is_expresiveness.html I was informed then that there is a academic...
8
by: g_man | last post by:
I am trying trap Runtime error 3022 (duplicates) in the click event of a command button that closes the form. I have code in the Form_Error event that does a good job of providing a more meaningful...
7
by: ruvi | last post by:
I am getting runtime error 3021 - Either EOF or BOF is true or the current record has been deleted..... I have 2 combo boxes in a form- One for the client and the other for the project. When the...
1
by: wagugwe | last post by:
Dear all, Am faced with the above problem. I am designing an application in VB.Net 2003 and using Ms Access 2000 as the database. I have the following code: Private Sub cmdSave_Click(ByVal...
3
by: Jim Armstrong | last post by:
Hello all - This is driving me crazy. I have a table called tblClients - very simple, has the following fields: taxID (PK) ClientName SalesName The main form of my application allows a...
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
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.