Keeping current record

A

Amour

Hi I am new to Access.

I have a Single Form (frmAtt) that when I select a record I than can click
on a button to open another Continuous form (frmTrv) and it will select that
records information from frmAtt.

Example:
Opened form(frmatt) = Opening form(frmTrv)
frmatt.xyz = A frmtrv.xyz = A
frmatt.zzz = B frmtrv.zzz = B

This part works fine...

But when I close frmtrv this is what happens:
Opened form(frmatt) closed form(frmTrv)
frmtrv.xyz = A frmatt.xyz = someother record
frmtrv.zzz = B frmatt.zzz = B

THIS IS THE PROBLEM!



When I delete the record from frmtrv:
Opened form(frmatt) closed form(frmTrv)
frmtrv.xyz = A frmatt.xyz = A
frmtrv.zzz = B frmatt.zzz = B

This works fine!

I want the frmtrv to close with the current record on the previous opened
form showing.

Here is the code behind the close button on the frmtrv:

Private Sub btnCloseForm_Click()
On Error GoTo Err_btnCloseForm_Click
If Len(Me.[Order_Num] & "") = 0 Then
MsgBox "Record has not been entered - No Order Number"
End If
DoCmd.Close
Exit_btnCloseForm_Click:
Exit Sub

Err_btnCloseForm_Click:
MsgBox Error$
Resume Exit_btnCloseForm_Click

End Sub


Here is the code on the delete button on the frmtrv (AND THIS WORKS FINE) I
just wanted to show you that this is working for when it closes it goes back
to the current previous record:

Private Sub btnDelete_Click()
On Error GoTo Err_btnDelete_Click
Dim dbs As Database
Dim myrs As Recordset

Set dbs = CurrentDb()

Set myrs = Me.RecordsetClone
If myrs.RecordCount > 0 Then
delRec = MsgBox("You are about to delete 1 record. " & Chr(13) &
Chr(10) & Chr(13) & Chr(10) & "If you click Yes, you won't be able to undo
this Delete Operation. " & Chr(13) & Chr(10) & "Delete Current Record?",
vbExclamation + vbYesNo, "Delete Record")
If delRec = 6 Then
xmeet_num = Me!MEET_NUM
xssn = Me!SSN
strSql = "delete * from tblTravel where meet_num = '" &
xmeet_num & "' and ssn = '" & xssn & "'"
dbs.Execute strSql

Forms!frmAttendanceMeeting!EST_TRVL = 500
Forms!frmAttendanceMeeting!ACT_TRVL = 0

End If
End If
DoCmd.Close
Exit_btnDelete_Click:
Exit Sub

Err_btnDelete_Click:
MsgBox Error$
Resume Exit_btnDelete_Click






Please help and thank you....!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top