Use listbox value to open record in another form

message from =?Utf-8?B?Q2FybmVnaWUyMw==?= on 1 Jun 2004
I have a listox called TenantList on a form called SelectAparment.
I want to select a name on TenantList and click on a button that will open a separate form called TenantsForm where the name on the TenantsForm record matches the name in the TenantList listbox.

Thanks.
 
Graham R Seach replied to =?Utf-8?B?Q2FybmVnaWUyMw==?= on 2 Jun 2004
Private Sub cmdMyButton_Click()
If Not IsNull(Me!TenantList) Then
DoCmd.OpenForm "TenantsForm", , , "TenantName = """ & Me!TenantList
& """"
End If
End Sub

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html

"Carnegie23" <anonymous@discussions.microsoft.com> wrote in message
news:CAF77E9B-A5FA-4C35-9BB0-5DD9E21A8A36@microsoft.com...
value, but it only seems to work if created on the same form. What I'm
trying to do is this find a record on another form. Specifically:
a separate form called TenantsForm where the name on the TenantsForm record
matches the name in the TenantList listbox.
 

Archived message: Use listbox value to open record in another form (Microsoft Access Database)