Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3595110
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:48:31+00:00 2026-05-18T19:48:31+00:00

I have an Access 2003 form with one subform, set to continuous forms, in

  • 0

I have an Access 2003 form with one subform, set to continuous forms, in a subform control. For one record in the main form, 1 to many records will appear in the sub form. The data displays properly.

The main form is named Widgets and the sub form is named Transactions. There are 5 textbox controls that display the data in the subform. The one in question is ReceiptDate.

What I would like to do is look at the values and determine if there was a receipt for the year 2009, and if so then change the background of that row to yellow so it stands out when the user encounters that condition. Maybe even change the date field’s font to boldface..

I tried many ways of referencing the subform’s controls. When I have tried Me.Transactions.ReceiptDate I have only received the first record in that subform. I’d like to be able to loop through them and see if the condition is met. I tried Me.Transactions.ReceiptDate(1) and Me.Transactions.ReceiptDate(0) and so forth.

I tried the For Each ctl In Form.Controls route as well. It worked for a few iterations and then I received a run-time error 2455 “You entered an expression that has an invalid reference to the property Form/Report”.

I had the subform in “datasheet” mode but thought that was causing me not to be able to read through an array of subform controls. So I changed it to “continuous” mode. I get the same errors for either.

Is there a way to reference specific “rows” in the subform and do something based on a value found? Also, I am performing this in the On Current event as I dont know where else to put the code. The subform loads before the parent form so its possible that these controls arent even fully “there” but then I do get the first row’s date when I try it in the Immediate Window.

UPDATE 12.23.2010:

With the gracious help of @Remou I am able to debug.print the ReceiptDate fields from the RecordSet. This is great because now I can evaluate the data and do certain things based on the values.. The @Remou’s code helped me put this into the OnCurrent event:

Dim i As Long
Dim frm As Form
Dim rs As DAO.Recordset

' Get the form and its recordset.
Set frm = Me.Form
Set rs = frm.RecordsetClone

' Move to the first record in the recordset.
rs.MoveFirst

' Move to the first selected record.
rs.Move frm.SelTop - 1

' Enumerate the list of selected records presenting the ReceiptDate field
For i = 1 To rs.RecordCount
    Debug.Print rs![ReceiptDate]
    rs.MoveNext
Next i

So now that I am able to know which row in my subform has a receipt from 2009, I need to be able to highlight the entire row or rows as I come across them in that for loop. How can I reference the actual row? Datasheet view or Continuous Forms view – I have tried both.

Conditional Formatting is great but it only allows me to highlight one particular record and I’d much rather be able to do this via VBA because…… from here I will want to give the use the ability to click on any record in the subform and get the receipt details and potentially print them.

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T19:48:32+00:00Added an answer on May 18, 2026 at 7:48 pm

    In this situation, it is best to use conditional formatting.

    To refer to a control on a subform, refer to the subform control by name, then the form property to get the form contained, then the control by name:

    Me.MySubformControlName.Form.MyControl
    

    See: http://www.mvps.org/access/forms/frm0031.htm

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.