Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100

    Passing records and changing fields for images

    I am a novice with Access and VBA so please bear with me.



    I have a form in an Access 2003 db in which I want to pass two selections (a record and a one of two fields in the selected record) to a subform or an object in the form which will display an image based on the two selections.

    The basic information is a table (tblPlayers) with information from baseball tabletop game and includes players, teams, and card images. Each player is a record and each record has two card image fields (actually a text field with the path to externally stored images), one for hitting and one for pitching as well as a field for the player’s team. So far, my main form, called frmVisitor, queries tblPlayers for a team then has 10 combo boxes to allow the selection of nine hitters and one pitcher from the queried team. This works fine.

    On the image display issue, I adapted the Microsoft Support kb 285820 solution into a form, dubbed frmVisImage, to show images. On a standalone basis, that works too. After extensive work, my novicity (I make up words too often) in working with VBA code has precluded my ability to connect the option group on frmVisitor to the record control on frmVisImage, let alone, get the frmVisitor to change the image path field on frmVisImage.

    I’ve included a screen capture of my current form (the one that is not communicating) to hopefully those who know more than I better understand where I am and where I want to be. I would GREATLY appreciate ANY help you all might offer.
    Last edited by oleBucky; 02-11-2011 at 06:32 PM. Reason: Attachment did not make it through.

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I think I'm looking at a Form with a SubForm on it. Maybe this will help: http://www.mvps.org/access/forms/frm0031.htm

  3. #3
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Looks interesting. I will see if I can make it work. Thanks so much.

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Let us know how you make out.

  5. #5
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    It appears my ability to adapt code to my evil plan has hit a wall. The wall is my total lack of knowledge of VBA syntax. I purchased a copy of “VBA for Dummies” and it was of some basic help however I am still unable to get where I need to be.

    Using guidance from the website suggested above and the option group (selectVisCard) as described in the thread’s first post, I’ve tried a myriad of syntax combinations to attempt to pass the PlayerID selected in a combo box from frmVisitor to the PlayerID text box in the subform frmVisImage without success. For example:
    Private Sub selectVisCard_AfterUpdate()
    Select Case [selectVisCard].Value
    Case 1
    Dim intPlayerID As Integer
    intPlayerID = Me.VisHit01Combo.Value
    Me!frmVisImage.Form!PlayerID.Value = intPlayerID
    End Select
    End Sub
    As YOU ALL can probably tell by looking (I obviously can't), this did not make it through the compiler. The debugger stopped on the Me! line so I know enough to know the first problem is there. However, I am not knowledgable enough to know what questions to ask to debug the problem. A couple of facts may come to bear. The combo box (VisHit01Combo) has two columns. The first is the AutoNumber for PlayerID and the second is the player's name. In the combo bos format, I hid the first column by giving it a width of 0". Can someone help?

    As a sidebar, I read the “10 Commandments” on web page in the thread and, lamentably, as you can tell from the code sample, I am a sinner. I repent all my sins. However, it was not within my programming skill to correct them all without butchering my db.

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Removing Lookup Fields is easy and painless: http://www.btabdevelopment.com/ts/removelookups
    Having ComboBoxes (Lookup's) on a form is just fine and preferred, just not at the table level. Removing these from a table does not effect an existing form in any way and therefore "painless".

  7. #7
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Thanks for that. Any suggestions on how to pass the PlayerID from the main form to the subform with the option group?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would try:
    Code:
    Case 1
    frmVisImage.Form.PlayerID = Me.VisHit01Combo

  9. #9
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    I'm going to try it now. I will let you know. Thanks again.

  10. #10
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    OK, now I am really going to show my ignorance. The subform control (text box) was not "PlayerID", but ""txtImageID" with "PlayerID" (the Autonumber from my table) as a control source. That acknowledged, I tried:

    Code:
     
    Case 1
    frmVisImage.Form.txtImageID = Me.VisHit01Combo
    This generated an error:

    Run-time error '-2147352567 (80020009)':
    You can't assign a value to this object.

    Clicking the "Help" button on the error message brings up a blank Microsoft Access Help window. Kinda the way I feelin' now.

    Is this a basic problem with the construction of my root table?

  11. #11
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Okay, you need to go about this differently. What do you have as the LinkChild/MasterFields properties of the SubFormControl?

  12. #12
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    I think you've hit on at least one of my problems. After a thorough search, I am unable to find any property that refers to LinkChild/MasterFields in either my main form (frmVisitor) or my subform (frmVisImage). I also looked at the table (tblPlayers) which is the record source for both frmVisitor and frmVisImage. No luck there. Where might I find such a beast?

    One observations: When I open frmVisitor in design view, the only way I can see the subform in design view is to open it in a new window. Whether this has any bearing on anything... I don't know.
    Last edited by oleBucky; 02-17-2011 at 06:30 PM. Reason: Spelling was never my strung suit.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Forms are displayed on other forms by means of a SubFormControl. It is this SubFormControl that has the LinkChild/MasterFields properties. Selecting it is more of a visual issue but it involves clicking on the upper left side of the SubFormControl. Good luck.

  14. #14
    oleBucky's Avatar
    oleBucky is offline Competent Performer
    Windows XP Access 2003
    Join Date
    Feb 2011
    Location
    Inside the Loop
    Posts
    100
    Found it with the help of a YouTube video tutorial.

    The Link Child Fields is set to PlayerID
    The Link Master Fields is set to PlayerID

  15. #15
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Create an invisible TextBox on your MainForm named txtPlayerID. Now set your LinkMasterField to point to this TextBox (Me.txtPlayerID). Now change your Case statements to:
    Case 1
    Me.txtPlayerID = Me.VisHit01Combo
    ...and see what happens.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Is this the best way to handle changing records?
    By teresamichele in forum Access
    Replies: 17
    Last Post: 02-14-2011, 09:58 AM
  2. Form Help with passing records
    By mwabbe in forum Forms
    Replies: 6
    Last Post: 09-08-2010, 11:06 AM
  3. Replies: 17
    Last Post: 08-26-2009, 11:27 AM
  4. changing a records field value
    By tubar in forum Queries
    Replies: 3
    Last Post: 07-06-2009, 07:36 AM
  5. Passing data to sequential form fields
    By jeepfamilyva in forum Forms
    Replies: 0
    Last Post: 06-28-2009, 11:04 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums