A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » New Users
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Opening a Form and Getting Value on A Click Event



 
 
Thread Tools Display Modes
  #1  
Old February 14th, 2006, 07:53 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Opening a Form and Getting Value on A Click Event

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?

  #2  
Old February 14th, 2006, 09:00 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Opening a Form and Getting Value on A Click Event

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


"Cliff" wrote:

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?


  #3  
Old February 14th, 2006, 11:24 PM posted to microsoft.public.access.gettingstarted
external usenet poster
 
Posts: n/a
Default Opening a Form and Getting Value on A Click Event

I explain here how to do this he

http://www.members.shaw.ca/AlbertKal...log/Index.html

--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada

http://www.members.shaw.ca/AlbertKallal


 




Thread Tools
Display Modes

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:59 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.