Results 1 to 6 of 6

Thread: table is empty

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    table is empty

    what will i do if the table has no entry and i will open it..
    here's my code
    VB Code:
    1. Private Sub MDIForm_Load()
    2. tbAcademicYear.Open "select * from tbacademicyear", cn, adOpenDynamic, adLockOptimistic
    3. If tbAcademicYear.Fields(1) = Null Then
    4.     Exit Sub
    5. Else
    6. Set tbAcademicYear = Nothing
    7. AY = "select * from tbacademicyear where Status like '" & "Open" & "'"
    8. tbAcademicYear.Open AY, cn, adOpenDynamic, adLockOptimistic
    9. StatusBar1.Panels(10) = tbAcademicYear.Fields(0)
    10. End If
    11. end Sub

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: table is empty

    Quote Originally Posted by mheiy
    what will i do if the table has no entry and i will open it..
    What do you need to do if it is empty?

  3. #3
    PowerPoster
    Join Date
    Feb 2006
    Location
    East of NYC, USA
    Posts
    5,691

    Re: table is empty

    VB Code:
    1. Private Sub MDIForm_Load()
    2. Dim tbAcademicYear As ADODB.Recordset
    3.  
    4.   Set tbAcademicYear = New ADODB.Recordset
    5.   AY = "select * from tbacademicyear where Status like '" & "Open" & "'"
    6.   tbAcademicYear.Open AY, cn, adOpenDynamic, adLockOptimistic
    7.   If Not tbAcademicYear.EOF Then
    8.     StatusBar1.Panels(10) = tbAcademicYear.Fields(0)
    9.   End If
    10.   Set tbAcademicYear = Nothing
    11. End Sub
    The most difficult part of developing a program is understanding the problem.
    The second most difficult part is deciding how you're going to solve the problem.
    Actually writing the program (translating your solution into some computer language) is the easiest part.

    Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.

    Please Help Us To Save Ana

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Nov 2006
    Posts
    84

    table is empty

    what will i do if the table has no entry and i will open it..
    here's my code
    VB Code:
    1. Private Sub MDIForm_Load()
    2. tbAcademicYear.Open "select * from tbacademicyear", cn, adOpenDynamic, adLockOptimistic
    3. If tbAcademicYear.Fields(1) = Null Then
    4.     Exit Sub
    5. Else
    6. Set tbAcademicYear = Nothing
    7. AY = "select * from tbacademicyear where Status like '" & "Open" & "'"
    8. tbAcademicYear.Open AY, cn, adOpenDynamic, adLockOptimistic
    9. StatusBar1.Panels(10) = tbAcademicYear.Fields(0)
    10. End If
    11. end Sub

  5. #5
    Frenzied Member TheBigB's Avatar
    Join Date
    Mar 2006
    Location
    *Stack Trace*
    Posts
    1,511

    Re: table is empty

    Please do not create duplicate threads.

  6. #6
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: table is empty

    Quote Originally Posted by TheBigB
    Please do not create duplicate threads.
    Duplicate threads merged.

    Please heed this advice and do not create duplicate threads for the same question.

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