View Full Version : Goto Record Problem


Majid Umar
08-10-2001, 02:27 AM
Hi there,

Well, I got these link buttons on forms to jump from say Case Details to Tenant Details. I used Macros to close the current form and open the target form say Tenant Form. But what I tried was to move to the same Tenant Record which was last viewed in Case Details say Case Details were for Tenant 1 so, when goto Tenant is clicked it goes to that particular Tenant.

If anybody can help please ???

aqif
08-11-2001, 08:02 PM
Hi http://www.access-programmers.co.uk/ubb/smile.gif

There are two ways to do that job http://www.access-programmers.co.uk/ubb/smile.gif

1. Make two Macros

Use OpenForm and specify the where condition as

[TblTenant]![MyField] = Forms![Cases]![MyField]

* TblTennant is the name of tenant table.

Then make a CloseForm action and I hope it will work http://www.access-programmers.co.uk/ubb/smile.gif

2. Write the code behind button

On Error GoTo Err_CmdTenantDetails_Click

Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "TenantForm"
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

stLinkCriteria = "[CaseField]=" & Me![TenantField]
DoCmd.OpenForm stDocName, , , stLinkCriteria

DoCmd.Close acForm, "FormCases"

Exit_CmdCancerDetails_Click:
Exit Sub

Err_CmdCancerDetails_Click:
MsgBox Err.Description
Resume Exit_CmdCancerDetails_Click

End Sub

The first method is simple and easy and i guess that u r not very much familiar with codes.....so better go for first one...n let me know if ur problem is still unsolved.

Cheers!
Aqif

Majid Umar
08-13-2001, 05:14 AM
Chase Mate!

That works fine, thanks for your time and help!