|
-
Jun 22nd, 2005, 01:23 AM
#1
Thread Starter
Addicted Member
[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:
Private Sub Form_Current()
If Len(sPunchCard) < 2 Then
Exit Sub
Else
If table_exists(sPunchCard) = True Then
SSubForm.Visible = True
SSubForm.Locked = True
SSubForm.SourceObject = "TABLE." & sPunchCard
Else
SSubForm.Visible = False
End If
End If
End Sub
Public Function table_exists(tblName As String) As Boolean
Dim i As Integer
table_exists = False
For i = 0 To CurrentDb.TableDefs.Count - 1
If CurrentDb.TableDefs(i).Name = tblName Then
table_exists = True
Exit Function
End If
Next
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
-
Jun 22nd, 2005, 03:25 AM
#2
Thread Starter
Addicted Member
Re: how to show sub datasheet on form?
sorry, i am a bit stupid today
i just need the
VB Code:
Private Sub Form_Current()
On Error Goto FormError
....
....
FormError:
Exit Sub
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|