p2p.wrox.com Forums

Need to download code?

View our list of code downloads.


Go Back   p2p.wrox.com Forums > Microsoft Office > Access and Access VBA > Access VBA
I forgot my password Register Now
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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.

Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old February 28th, 2005, 05:04 PM
Authorized User
Points: 174, Level: 3
Points: 174, Level: 3 Points: 174, Level: 3 Points: 174, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2005
Location: , , .
Posts: 51
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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




Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
  #2 (permalink)  
Old March 1st, 2005, 04:37 PM
Friend of Wrox
Points: 9,516, Level: 42
Points: 9,516, Level: 42 Points: 9,516, Level: 42 Points: 9,516, Level: 42
Activity: 11%
Activity: 11% Activity: 11% Activity: 11%
 
Join Date: Mar 2004
Location: Washington, DC, USA.
Posts: 3,060
Thanks: 0
Thanked 10 Times in 10 Posts
Default

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
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
count data from subform Vince_421 Access 1 May 27th, 2006 12:51 PM
Subform not displaying data hikinfool Access 8 February 24th, 2006 06:11 PM
Subform on many to many data aware Access 14 August 12th, 2005 03:36 AM
How to display a table in a Subform Suomi Access 4 July 1st, 2005 10:09 AM
subform data in report exhibitor Access 4 May 16th, 2005 01:19 PM



All times are GMT -4. The time now is 10:11 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
© 2008 Wiley Publishing, Inc