473,398 Members | 2,188 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,398 software developers and data experts.

why i get sometimes the message

Expand|Select|Wrap|Line Numbers
  1. Private Sub student_id_AfterUpdate()
  2. 'On Error GoTo Err_cmdshow
  3. Dim db As Database
  4. Dim r1 As Recordset
  5. Dim r2 As Recordset
  6. Set db = CurrentDb()
  7. Dim i As Integer
  8. Dim mclass As String
  9.  
  10. Dim mmonth As Integer
  11. mmonth = 6
  12. If Me.NewRecord Then
  13. db.Execute "delete * from [csubjects]", dbFailOnError
  14. db.Execute "INSERT INTO [csubjects] " & _
  15. "SELECT [subjects].* FROM subjects " & _
  16. "WHERE [subjects].[class_id] = '" & Me.Parent.class_id & "'"
  17.  
  18. 'MsgBox ("hello")
  19. mclass = Me.Parent.class_id
  20. MsgBox (mclass)
  21.  
  22. Set r1 = db.OpenRecordset("cexams", dbOpenTable)
  23. Set r2 = db.OpenRecordset("csubjects", dbOpenTable)
  24. 'msubject_no = DCount("[class_id]", "[csubjects]")
  25. 'MsgBox (str(msubject_no))
  26.  'r2.Index = "primarykey"
  27. If r2.RecordCount > 0 Then
  28.         'For i = 1 To mmonth
  29.         r2.MoveFirst
  30.         ' MsgBox (" subj " & str(r2![subject_id]) & "i   " & str(i))
  31.         'MsgBox ("subj= " & str(r2![subject_id]))
  32.             Do Until r2.EOF
  33.                 For i = 1 To mmonth
  34.                    r1.Index = "primarykey"
  35.  
  36.                    r1.Seek "=", mclass, r2![subject_id], Me.student_id, i
  37.                    'MsgBox ("c = " & mclass & "s = " & str(r2![subject_id]) & " " & "st " & Me.student_id & "m " & str(i))
  38.                       If r1.NoMatch Then
  39.                         r1.AddNew
  40.                         r1![class_id] = Me.Parent.class_id
  41.                         r1![student_id] = Me.student_id
  42.                         r1![student_name] = Me.student_name
  43.                         r1![month_id] = i
  44.                         r1![subject_id] = r2![subject_id]
  45.                          r1![coef] = r2![coef]
  46.                        'r1![grade] = r2![grade]
  47.  
  48.                         r1.Update
  49.                      Else
  50.                      'MsgBox ("subj= " & str(r2![subject_id]))
  51.                      MsgBox "found"
  52.                     End If
  53.                    Next i
  54.                 r2.MoveNext
  55.            Loop
  56.         'Next i
  57.  
  58.  
  59.  
  60.     Else
  61.         MsgBox "empty subjects"
  62.     End If
  63. r1.Close
  64. r2.Close
  65. 'Me.Refresh
  66.  
  67. End If
  68.  
  69. Exit_cmdshow:
  70.     Exit Sub
  71.  
  72. Err_cmdshow:
  73.     MsgBox Err.Description
  74.     Resume Exit_cmdshow
  75. End Sub
Mar 22 '16 #1
1 754
Rabbit
12,516 Expert Mod 8TB
Please use code tags when posting code or formatted data.

You haven't told us what problem your having.
Mar 22 '16 #2

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

Similar topics

6
by: Stephane Dalpe | last post by:
Hi all, I just want to know why when I'm installing jdk sometimes ask me to reboot and sometimes he don't. As part of our installation, we launch the jdk installation if it's not already...
12
by: Sven Groot | last post by:
I have a Windows Service application that acts as if it's an SMTP server. Outlook connects to this service, which is always running on the localhost. This works fine most of the time. However,...
6
by: Ron Brennan | last post by:
Good evening. An HTML problem maybe, but one that I think can be solved with JavaScript. I have a page which is supposed to display several small JPEG images using elements like: <image...
7
by: xzzy | last post by:
I inherited the following Access XP app: There are about a dozen data files, most are linked. The goal is to add, subtract, multiply and divide some numbers to produce a number. The resultset...
0
by: Kimmo Laine | last post by:
Hi, how can i be sure that the MSMQ Message.Body property contains something valid? If i send the message like this: public void SendMyMessage( int msgCode, object msgData ) { Message msg =...
4
by: Ersin Gençtürk | last post by:
Server : WEB System.Web.HttpUnhandledException: Exception of type System.Web.HttpUnhandledException was thrown. ---> System.Web.HttpException: The View State is invalid for this page and might be...
6
by: Dot net work | last post by:
I've read quite a few threads on these groups about this. When someone says the following: "My Page_Load gets called twice on a button click postback" The replies are: "Do you have...
3
by: doobdave | last post by:
Hi all, I'm experiencing a rather strange problem: I am coding a web application using VB.net ASP.net and Visual Studio 2003. It's quite a large application, but the problem only occurs on...
6
by: blash | last post by:
Can someone help me? I really don't have a clue. My company staff told me they often got such error: "Object reference not set to an instance of an object." when they are in search result page...
2
by: Darin | last post by:
I have the following code that opens a comma-delimited text file: connS = "Provider=Microsoft.Jet.OLEDB.4.0;" connS &= "Data Source=\tmp;" connS &= "Extended...
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: 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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.