C
CF
I am hoping someone could shed some light of what I am
doing wrong.
I have a form which allows the user to make some changes
and allows them to open another form to make further
changes. The link between the 2 forms works fine.
However, I am not able to populate the form with the
customers information to allow the user to make changes.
Any help would be much appreciated.
code for first form:
Private Sub chgAttr_Click()
On Error GoTo Err_chgAttr_Click
Dim UPI As String
If IsNull(Me.txtNUPI) = False Then
UPI = Me.txtNUPI
Else
UPI = Me.txtUPI
End If
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmStudentInfo"
stLinkCriteria = "[txtID]='" & UPI & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_chgAttr_Click:
Exit Sub
Err_chgAttr_Click:
MsgBox Err.Description
Resume Exit_chgAttr_Click
End Sub
code for second form:
Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.txtID) Then
Else
If Forms!frmModify.Visible Then
Dim dbs As Database
Dim rst As Recordset
Dim rst2 As Recordset
Dim strSearchName As String
Dim Id As String
DataEntry = False
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tblSTudentData")
Set rst2 = Me.RecordsetClone
strSearchName = Me.txtID
rst2.FindFirst "UPI = '" & strSearchName & "'"
If rst2.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst2.Bookmark
End If
End If
End If
End Sub
doing wrong.
I have a form which allows the user to make some changes
and allows them to open another form to make further
changes. The link between the 2 forms works fine.
However, I am not able to populate the form with the
customers information to allow the user to make changes.
Any help would be much appreciated.
code for first form:
Private Sub chgAttr_Click()
On Error GoTo Err_chgAttr_Click
Dim UPI As String
If IsNull(Me.txtNUPI) = False Then
UPI = Me.txtNUPI
Else
UPI = Me.txtUPI
End If
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmStudentInfo"
stLinkCriteria = "[txtID]='" & UPI & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria
Exit_chgAttr_Click:
Exit Sub
Err_chgAttr_Click:
MsgBox Err.Description
Resume Exit_chgAttr_Click
End Sub
code for second form:
Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.txtID) Then
Else
If Forms!frmModify.Visible Then
Dim dbs As Database
Dim rst As Recordset
Dim rst2 As Recordset
Dim strSearchName As String
Dim Id As String
DataEntry = False
Set dbs = CurrentDb()
Set rst = dbs.OpenRecordset("tblSTudentData")
Set rst2 = Me.RecordsetClone
strSearchName = Me.txtID
rst2.FindFirst "UPI = '" & strSearchName & "'"
If rst2.NoMatch Then
MsgBox "Record not found"
Else
Me.Bookmark = rst2.Bookmark
End If
End If
End If
End Sub