Results 1 to 4 of 4

Thread: helppppp

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    helppppp

    can anyone help me with this because when i adding or clicking he cmdComplete the .eof is always false thats why i can


    VB Code:
    1. Option Explicit
    2. Public State As FormState
    3. Dim rsr As String 'for reservation string
    4.  
    5. Dim a As Variant
    6. Sub rload()
    7. Set tbCourse = New ADODB.Recordset
    8. tbCourse.Open "SELECT * FROM tbcourse ", cn, adOpenStatic, adLockReadOnly
    9. End Sub
    10.  
    11.  
    12. Private Sub cmbCourse_Click()
    13. a = cmbCourse.Text
    14.  
    15. Call rload
    16.  Do While tbCourse!CourseName <> a
    17.  tbCourse.MoveNext
    18.  If tbCourse!CourseName = a Then
    19.  txtBatch.Text = tbCourse!BatchNumber
    20.     End If
    21. Loop
    22.  
    23. End Sub
    24.  
    25. Private Sub cmdCancel_Click()
    26. ans = MsgBox("Are you sure you want to cancel this?", vbYesNo + vbQuestion, " Titus School of Multimedia")
    27.     If ans = vbYes Then
    28.       Unload Me
    29. '      tbInquiry.Close
    30.     End If
    31. End Sub
    32.  
    33. Private Sub cmdCheckAvail_Click()
    34. If CheckTextBox(cmbCourse, "Invalid 'COURSE' value. This field is required, please enter a value.") = False Then
    35. ElseIf CheckTextBox(txtBatch, "Invalid 'BATCH NUMBER' value. This field is required, please enter a value.") = False Then
    36. ElseIf frmCheckAvail.txtReser(4).Text = 0 Then
    37.     MsgBox "No seat/s available", vbInformation, "Titus School of Multimedia"
    38. Else
    39.     frmCheckAvail.Show
    40. End If
    41. End Sub
    42.  
    43. Private Sub cmdComplete_Click()
    44.  
    45. If CheckTextBox(cmbCourse, "Invalid 'COURSE' value. This field is required, please enter a value.") = False Then
    46.    
    47. ElseIf CheckTextBox(txtBatch, "Invalid 'BATCH NUMBER' value. This field is required, please enter a value.") = False Then
    48.    
    49. ElseIf CheckTextBox(txtNoSeat, "Invalid 'NO. OF SEAT' value. This field is required, please enter a value.") = False Then
    50.    
    51. ElseIf CheckTextBox(txtAppID, "You cannot move to this part unless you have created New Applicant ID.") = False Then
    52.     StartTxt txtAppID
    53. ElseIf CheckTextBox(txtAppInfo(0), "Invalid 'FIRST NAME' value. This field is required, please enter a value.") = False Then
    54.     StartTxt txtAppInfo(0)
    55. ElseIf CheckTextBox(txtAppInfo(1), "Invalid 'Middle Name' value. This field is required, please enter a value.") = False Then
    56.     StartTxt txtAppInfo(1)
    57. ElseIf CheckTextBox(txtAppInfo(2), "Invalid 'LAST NAME' value. This field is required, please enter a value.") = False Then
    58.     StartTxt txtAppInfo(2)
    59. ElseIf CheckTextBox(txtAppInfo(3), "Invalid 'ADDRESS' value. This field is required, please enter a value.") = False Then
    60.     StartTxt txtAppInfo(3)
    61. ElseIf CheckTextBox(txtAppInfo(4), "Invalid 'CONTACT NO' value. This field is required, please enter a value.") = False Then
    62.     StartTxt txtAppInfo(4)
    63. Else
    64.        With tbInquiry
    65.           .Open
    66.            .MoveFirst
    67.             .Find "ApplicantID = '" & txtAppID & "'"
    68.             If .EOF = True Then
    69.                 .AddNew
    70.                 AddFields
    71.                 .Update
    72.                 .Requery
    73.              End If
    74.         End With
    75.        
    76.  
    77.        
    78.     ans = MsgBox("New reservation entry successfully saved to the record." & vbNewLine & "Do You Want To Add Another Record?", vbYesNo, "Titus School Of Multimedia")
    79.     If ans = vbNo Then
    80.         Unload Me
    81.     End If
    82.        
    83.      
    84. End If
    85. End Sub
    86.  
    87. Private Sub cmdSearch_Click()
    88. frmSearch.Show
    89. End Sub
    90.  
    91. Private Sub Form_Load()
    92. Dim cmb As ListItem
    93.  
    94. Set tbInquiry = Nothing
    95. tbInquiry.Open "Select * from tbinquiry", cn, adOpenDynamic, adLockOptimistic
    96.  
    97. tbCourse.Open "Select * from tbCourse", cn, adOpenDynamic, adLockOptimistic
    98.  
    99.  
    100. With tbInquiry
    101.     frmInquiryForm.txtAppInfo(0).Text = frmAddReservation.txtAppInfo(0).Text
    102.     frmInquiryForm.txtAppInfo(1).Text = txtAppInfo(1).Text
    103.     frmInquiryForm.txtAppInfo(2).Text = txtAppInfo(2).Text
    104.     frmInquiryForm.txtAppInfo(3).Text = txtAppInfo(3).Text
    105.     frmInquiryForm.txtAppInfo(4).Text = txtAppInfo(4).Enabled = True
    106. End With
    107.  
    108. With tbCourse
    109.  If .BOF = True And .EOF = True Then
    110.         Refresh
    111.     Else
    112.         Do Until .EOF
    113.             cmbCourse.AddItem (.Fields(0))
    114.            ' cmbBatch.AddItem (.Fields(2))
    115.             .MoveNext
    116.         Loop
    117.     End If
    118. End With
    119.  
    120.  
    121.  
    122. End Sub
    123.  
    124.  
    125. Private Sub AddFields()
    126.  
    127. With tbInquiry
    128.     .Fields(0) = txtAppID
    129.     .Fields(1) = txtAppInfo(0)
    130.     .Fields(2) = txtAppInfo(1)
    131.     .Fields(3) = txtAppInfo(2)
    132.     .Fields(4) = txtAppInfo(3)
    133.     .Fields(5) = txtAppInfo(4)
    134.     .Fields(6) = txtTFA
    135.     '.Fields(7) = creationdate
    136.     .Fields(8) = cmbCourse.Text
    137.     .Fields(9) = txtBatch
    138.     .Fields(10) = txtNoSeat
    139.     .Fields(11) = txtdateReserved
    140.     .Fields(12) = txtEndReserved
    141.     .Fields(13) = "Reserved"
    142.    
    143. End With
    144. End Sub
    145.  
    146. Private Sub EraseAll()
    147. For i = 0 To 4
    148. txtAppInfo(i) = ""
    149. Next i
    150. txtAppInfo(0).SetFocus
    151.  
    152. For i = 0 To 4
    153. optTFA(i) = ""
    154. Next i
    155. End Sub
    156.  
    157.  
    158. Private Sub Form_Unload(Cancel As Integer)
    159. 'tbReservation.Close
    160. End Sub
    161. '
    162. 'Private Sub txtNoSeat_LostFocus()
    163. 'With tbCourse
    164. '    .Fields(4) = txtNoSeat.Text - .Fields(1)
    165. 'End With
    166. '
    167. 'End Sub

  2. #2
    Learning .Net danasegarane's Avatar
    Join Date
    Aug 2004
    Location
    VBForums
    Posts
    5,853

    Re: helppppp

    VB Code:
    1. tbInquiry.open "Select * from tbcourse where ApplicantID = '" & txtAppID & "'", cn, adOpenStatic, adLockReadOnly
    2.    If tbInquiry.EOF = True Then
    3.         With tbInquiry
    4.                  .AddNew
    5.                 AddFields
    6.                 .Update
    7.         End If
    8.    End If
    Please mark you thread resolved using the Thread Tools as shown

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: helppppp

    what about if i dont have a record on my table and i will add a new one i always got an error of either .eof or .bof is true, or current recordset are closed.opretaions requires a record
    VB Code:
    1. Private Sub cmdSave_Click()
    2.  
    3. If CheckTextBox(txtDepTitle, "Invalid 'DEPARTMENT Title' value. This field is required, please enter a value.") = False Then
    4.          StartTxt txtDepTitle
    5. Else
    6.        With tbDepartment
    7.            .MoveFirst
    8.             .Find "DepartmentName = '" & txtDepTitle & "'"
    9.             If .EOF = True Then
    10.                 .AddNew
    11.                 .Fields(0) = txtDepTitle
    12.                 .Update
    13.                 .Requery
    14.              End If
    15.         End With
    16.    
    17.     ans = MsgBox("New Deparment entry successfully saved to the record." & vbNewLine & "Do You Want To Add Another Record?", vbYesNo, "Titus School Of Multimedia")
    18.     If ans = vbNo Then
    19.         Unload Me
    20.     End If
    21.    
    22. End If
    23.    
    24. End Sub
    25.  
    26. Private Sub Form_Load()
    27. tbDepartment.Open "Select * from tbdepartment where 1<>1", cn, adOpenDynamic, adLockOptimistic
    28. End Sub

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    Re: helppppp

    are u there daragesagane

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width