PC Review


Reply
Thread Tools Rate Thread

Opening 2nd form after selecting a record

 
 
=?Utf-8?B?RWRkaWVa?=
Guest
Posts: n/a
 
      9th Nov 2004
How do I open a 2nd form after user selects a record on the 1st
form(datasheet view) The 2nd form contains more details Thanks for your help
 
Reply With Quote
 
 
 
 
=?Utf-8?B?U3ByaW5rcw==?=
Guest
Posts: n/a
 
      9th Nov 2004
Hi, Eddie.

You can't put a button on a form in datasheet view. One option is to
include a button on a Continuous Form, which can be made to look much like
datasheet view.

Or you could use another event, such as double-clicking on a field. The
following code opens a second form by clicking on the ID field, and filters
the second form by matching the ID field to the value of the current record
on the 1st form.

Private Sub ID_DblClick(Cancel As Integer)
On Error GoTo Err_ID_DblClick

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "PUTYOUR FORMNAME HERE"

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

Exit_ID_DblClick:
Exit Sub

Err_ID_DblClick:
MsgBox Err.Description
Resume Exit_ID_DblClick
End Sub

HTH
Sprinks


"EddieZ" wrote:

> How do I open a 2nd form after user selects a record on the 1st
> form(datasheet view) The 2nd form contains more details Thanks for your help

 
Reply With Quote
 
 
 
 
StCyrM
Guest
Posts: n/a
 
      12th Nov 2004
Good evening

The general statement would be as follows. Simply replace frmDetails with your
form name as well as the RecordID with the proper ID


DoCmd.OpenForm "frmDetails", _
WhereCondition:="RecordID=" & Me.RecordID


Best Regards

Maurice St-Cyr
Micro Systems Consultants, Inc.


>How do I open a 2nd form after user selects a record on the 1st
>form(datasheet view) The 2nd form contains more details Thanks for your
>help



 
Reply With Quote
 
=?Utf-8?B?Tmlra2lC?=
Guest
Posts: n/a
 
      13th Jun 2005
I would like to use the information from this original email to open a
Report(rather then a Form) from a Form after selecting record.

The coding works if I create a Form named "Label" but I cannot figure out
how to specify and open a Report named "Label".

I have attached the VB code I'm using for your review. First I save the
selected record and then I would like to open the report named "Label".

Private Sub Save_Click()
On Error GoTo Err_Save_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Label"

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

Exit_Save_Click:
Exit Sub

Err_Save_Click:
MsgBox Err.Description
Resume Exit_Save_Click
End Sub

Sorry but I am brand new at using VB coding in Access.

Thanks so much for any help,

NikkiB

"EddieZ" wrote:

> How do I open a 2nd form after user selects a record on the 1st
> form(datasheet view) The 2nd form contains more details Thanks for your help

 
Reply With Quote
 
=?Utf-8?B?Tmlra2lC?=
Guest
Posts: n/a
 
      15th Jun 2005
Figured it out.

Had to change:
stDocName = "Label"

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

To:
stDocName = "Label"

stLinkCriteria = "[Key]=" & Me![Key]
DoCmd.OpenReport stDocName, , , stLinkCriteria

But this just automatically printed the report so I further changed the
coding to open the report in print preview allowing the user to review the
information. Here was the final coding I used.

stDocName = "Label"

stLinkCriteria = "[Key]=" & Me![Key]
DoCmd.OpenReport stDocName, acPreview , , stLinkCriteria

"NikkiB" wrote:

> I would like to use the information from this original email to open a
> Report(rather then a Form) from a Form after selecting record.
>
> The coding works if I create a Form named "Label" but I cannot figure out
> how to specify and open a Report named "Label".
>
> I have attached the VB code I'm using for your review. First I save the
> selected record and then I would like to open the report named "Label".
>
> Private Sub Save_Click()
> On Error GoTo Err_Save_Click
>
>
> DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
>
> Dim stDocName As String
> Dim stLinkCriteria As String
>
> stDocName = "Label"
>
> stLinkCriteria = "[Key]=" & Me![Key]
> DoCmd.OpenForm stDocName, , , stLinkCriteria
>
> Exit_Save_Click:
> Exit Sub
>
> Err_Save_Click:
> MsgBox Err.Description
> Resume Exit_Save_Click
> End Sub
>
> Sorry but I am brand new at using VB coding in Access.
>
> Thanks so much for any help,
>
> NikkiB
>
> "EddieZ" wrote:
>
> > How do I open a 2nd form after user selects a record on the 1st
> > form(datasheet view) The 2nd form contains more details Thanks for your help

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How to link a 1st form to 2nd form which the 2nd form is link to a table tina Microsoft Access Forms 1 22nd Nov 2008 05:19 PM
Re: Selecting the last record (2nd) of a duplicate record and moving Vincent Johns Microsoft Access Getting Started 0 28th Oct 2005 12:00 AM
Selecting the last record (2nd) of a duplicate record and moving Kathie G via AccessMonster.com Microsoft Access Getting Started 1 27th Oct 2005 09:25 PM
Re: Selecting the last record (2nd) of a duplicate record and moving Vincent Johns Microsoft Access Getting Started 0 27th Oct 2005 12:00 AM
please help... can't add new record in form... 2nd record changes =?Utf-8?B?c2VyYXBo?= Microsoft Access Getting Started 5 29th May 2005 12:06 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:44 PM.