Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / April 2005

Tip: Looking for answers? Try searching our database.

Connecting two forms with one field in Access when you click a button.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JJ - 14 Apr 2005 20:38 GMT
I am trying to open a second form from a the first one
when I click on a button and the second form is supposed
to show the information for the field Application Name
which needs to be pulled from the first form.

I have tried using:

Private Sub cmdInterfaceList_Click()

   Dim stDocName As String
   Dim stLinkCriteria As String

   stDocName = "frmApplicationInterface"
   stLinkCriteria = "[Application Name]"
   DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub  

This opens the second form, but the Application Name that
it uses does not match the one showing in the first form.

I have also tried using:

Private Sub cmdInterfaceList_Click()

   Dim stDocName As String
   Dim stLinkCriteria As String

   stDocName = "frmApplicationInterface"
   stLinkCriteria = "[Application Name]= Me![Application
Name]"

   DoCmd.OpenForm stDocName, , , stLinkCriteria

This opens a small window that asks you to enter the
Parameter Value for Me!Application Name.

What can I change to make the second window open with the
correct Application Name without having to type it into a
parameter window?

Thanks!
John Vinson - 14 Apr 2005 21:07 GMT
>I am trying to open a second form from a the first one
>when I click on a button and the second form is supposed
>to show the information for the field Application Name
>which needs to be pulled from the first form.

>Private Sub cmdInterfaceList_Click()
>
[quoted text clipped - 13 lines]
>correct Application Name without having to type it into a
>parameter window?

This is closer - but you're passing it the literal text string
Me![Application Name] rather than the *value* within that control.

Try

stLinkCriteria = "[Application Name]= '" & Me![Application Name] & "'"

assuming that ApplicationName is a Text field, therefore needing
delimiters ' around it.

                 John W. Vinson[MVP]    
JJ - 15 Apr 2005 13:20 GMT
Thank you John, that allowed the second form to come up
without the small parameter window, but now the value
that is in Application Name, isn't the value pulled into
the second form.  It actually lists the first value in
the table for the Application Name.  In the first form,
Application Name is a drop down list, could this be why
the value is not being transferred?  If so, is there a
way to set it so that the value that is picked from the
drop down list is what is transferred?

Thanks agagin for your help!

>-----Original Message-----
>
[quoted text clipped - 33 lines]
>                  John W. Vinson[MVP]    
>.
John Vinson - 15 Apr 2005 18:14 GMT
>Thank you John, that allowed the second form to come up
>without the small parameter window, but now the value
[quoted text clipped - 5 lines]
>way to set it so that the value that is picked from the
>drop down list is what is transferred?

I have no idea how your tables are structured, so I'm not at all sure
what field should be passed. Remember: a combo box ("dropdown") is NOT
data; it's a display tool. The value stored in the table is NOT
necexsarily the same as the value that you see; in fact it usually
isn't!

If you pass the value of the combo box in your code, what will be
passed is the bound column - which may well be an invisible numeric
ID. On the second form, you should also have an invisible numeric ID
and it's that field which should be set.

                 John W. Vinson[MVP]    
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.