D
doyapore
Dear All,
The following piece of code is an extract from an application which I am
developing at the moment.
*************** Code Begins ******************
Public Sub Proc_FamilyRelation(parCardSlNo As String)
On Error GoTo Err_Msg
Dim dbslocal As Object
Dim rstDTE As Object
Set dbslocal = CurrentDb
Set rstDTE = dbslocal.openrecordset("DTE")
Dim vrFamilyRelation As String
With rstDTE
.Index = "CARD_SLNO"
.Seek "=", parCardSlNo
If .NoMatch Then
lblFamilyRelation.Caption = "No relation exists in tabled
information"
Beep
GoTo Eject_Sub
End If
vrFamilyRelation = !Relation
If vrFamilyRelation = Null Then
lblFamilyRelation.Caption = "Relationship undefined in tabled
information"
Else
lblFamilyRelation.Caption = "Relationship : " + vrFamilyRelation
End If
End With
GoTo Eject_Sub
Err_Msg:
MsgBox Err.Description, , "Procedural error"
MsgBox Err.Number, , "Procedural error"
Resume Next
Eject_Sub:
rstDTE.Close
dbslocal.Close
End Sub
***************** code ends *****************
I have noticed that if a DIM statement defining a variable is placed before
the DIM statements which define the database and the recordset as objects, I
get an error. The error(s) is generated around the .Index verb.
My question is whether this is part of the VBA syntax. Can someone shed
somelight in this context?
Your suggestions and advice are always highly appreciated and prized.
Thank you.
The following piece of code is an extract from an application which I am
developing at the moment.
*************** Code Begins ******************
Public Sub Proc_FamilyRelation(parCardSlNo As String)
On Error GoTo Err_Msg
Dim dbslocal As Object
Dim rstDTE As Object
Set dbslocal = CurrentDb
Set rstDTE = dbslocal.openrecordset("DTE")
Dim vrFamilyRelation As String
With rstDTE
.Index = "CARD_SLNO"
.Seek "=", parCardSlNo
If .NoMatch Then
lblFamilyRelation.Caption = "No relation exists in tabled
information"
Beep
GoTo Eject_Sub
End If
vrFamilyRelation = !Relation
If vrFamilyRelation = Null Then
lblFamilyRelation.Caption = "Relationship undefined in tabled
information"
Else
lblFamilyRelation.Caption = "Relationship : " + vrFamilyRelation
End If
End With
GoTo Eject_Sub
Err_Msg:
MsgBox Err.Description, , "Procedural error"
MsgBox Err.Number, , "Procedural error"
Resume Next
Eject_Sub:
rstDTE.Close
dbslocal.Close
End Sub
***************** code ends *****************
I have noticed that if a DIM statement defining a variable is placed before
the DIM statements which define the database and the recordset as objects, I
get an error. The error(s) is generated around the .Index verb.
My question is whether this is part of the VBA syntax. Can someone shed
somelight in this context?
Your suggestions and advice are always highly appreciated and prized.
Thank you.