Results 1 to 2 of 2

Thread: [solved] how to show sub datasheet on form?

Threaded View

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2005
    Posts
    158

    Resolved [solved] how to show sub datasheet on form?

    hi,
    i wish to load a sub datasheet on form based on a value of a textbox (in that form also)

    i use the following code
    the sPunchCard is a textbox which contained the value of the wanna loaded table name.

    VB Code:
    1. Private Sub Form_Current()
    2.    
    3.     If Len(sPunchCard) < 2 Then
    4.         Exit Sub
    5.     Else
    6.         If table_exists(sPunchCard) = True Then
    7.             SSubForm.Visible = True
    8.             SSubForm.Locked = True
    9.             SSubForm.SourceObject = "TABLE." & sPunchCard
    10.         Else
    11.             SSubForm.Visible = False
    12.         End If
    13.     End If
    14. End Sub
    15.  
    16. Public Function table_exists(tblName As String) As Boolean
    17. Dim i As Integer
    18.     table_exists = False
    19.    
    20.     For i = 0 To CurrentDb.TableDefs.Count - 1
    21.         If CurrentDb.TableDefs(i).Name = tblName Then
    22.             table_exists = True
    23.             Exit Function
    24.         End If
    25.     Next
    26. End Function


    the code functions well, but when it comes to the last record, and after use press the next record, it presents with an error box

    Run-time error '94':
    Invalid use of Null

    anyone have any ideas?
    Last edited by asmdev; Jun 22nd, 2005 at 03:25 AM.
    if u felt my post make u happy ,
    then u could make me happy too by rating my post

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