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 / New Users / February 2006

Tip: Looking for answers? Try searching our database.

Opening a Form and Getting Value on A Click Event

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Cliff - 14 Feb 2006 19:53 GMT
It has been a while since I done much Access VBA. I have a form
(frmInspectionDetail) to collect inspection data. On that form there is
a button that opens another form (frmPanel) that has several command
buttons that represent the items being inspected. I need to be able to
click on one of the items and have a variable associated with that item
(found in a table) passed back to the original calling form
(frmInspectionDetail), which will still be open.

I am not sure of the approach. In general I guess I need the command
button on the first form to launch some type of function that awaits
the value from the second form to be passed back so it can catch it.

Thanks for any ideas on how to do this?
Klatuu - 14 Feb 2006 21:00 GMT
There is a better way.  Rather than opening a second form and passing data
back and forth, you could create a Combo Box control on your first form that
would give you a list of all the items being inspected.  Then when you select
an item from that list, use the After Update event of the Combo Box to
retrieve the data from the table and put it in your text box.  Here is an
example of how that could work.  Of course you will have to change the code
to use your own names, etc:

Private Sub cboItemList_AfterUpdate()
Dim varItem as Variant

   On Error GoTo cboItemList_AfterUpdate_Error

   If Not IsNull(Me.cboItemList) Then
       varItem = DLookup("[SomeField]", "SomeTable", "[Field to Match] = '" _
           & Me.cboItemList & "'"
       If IsNull(varItem) Then
           MsgBox "Can't Find That Item"
       Else
           Me.SomeTextBox = varItem
       End If
   End If

cboItemList_AfterUpdate_Exit:

   On Error Resume Next
   Exit Sub

> It has been a while since I done much Access VBA. I have a form
> (frmInspectionDetail) to collect inspection data. On that form there is
[quoted text clipped - 9 lines]
>
> Thanks for any ideas on how to do this?
Albert D.Kallal - 14 Feb 2006 23:24 GMT
I explain here how to do this here:

http://www.members.shaw.ca/AlbertKallal/Dialog/Index.html

Signature

Albert D. Kallal   (Access MVP)
Edmonton, Alberta Canada
pleaseNOOSpamKallal@msn.com
http://www.members.shaw.ca/AlbertKallal

 
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.