|
|
 |
| Access VBA Discuss using VBA for Access programming. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

February 28th, 2005, 05:04 PM
|
|
Authorized User
|
|
Join Date: Jan 2005
Location: , , .
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Display data in a subform
I have two tables:
tCon: tTrans:
ConID TransID
EnvNo EnvNo
Name Money
Desc
Basically its a form(works on tTrans) with a subform(works on tCon) in it and what I need it to do is when I type in a EnvNo, after I lose focus with it I need it to display below, where the subform is the informaiton for that EnvNo account(displays Name and desc). How can I go about display that. Here is what I have but I am not sure how to send the id so that it can be displayed in the subform which is part of my main form.
Private Sub txtEnvNo_LostFocus()
On Error GoTo errhandler
Dim strConId As String
If txtEnvNo.Text <> "" Then
intEnvNo = txtEnvNo.Text
strConId = DLookup("[ConID]", "tCon", "[EnvNo]=" & intEnvNo)
Else
MsgBox "Please input a EnvNo"
End If
Exit Sub
errhandler:
MsgBox "Record does not exist"
End Sub
|

March 1st, 2005, 04:37 PM
|
|
Friend of Wrox
|
|
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
|
|
If you click on the main table, and then click autoform, it will create a linked main form and subform.
Then use the combo box wizard to find a record on the form, and look up the proper meaningful field on the main form.
Then add this to the form's On Current Event:
'==========
cboYourLookUpComboBox = TransID
'==========
This will synchronize the look up combo box with the main form's current record.
HTH.
mmcdonal
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |