473,396 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to show records on 2nd subform when 1st subform is activated

I have the following in a form:

- Main Form which stores EE details [Mileage Expense Form]

- 1st subform [SubFSiteInfo] - a continuous form with a combo box which allows either selection of an existing contract or option to open a Contract Form to add.

- 2nd subform [SubFMileageInfo] - a continuous form which shows employee travel information relative to the contract number they are working on at that time.

This all works fine and returns the correct records.

However, when you go back into the form and click on a record on the 1st subform, the related records to not show on the 2nd subform until you click on to the 2nd record of the first subform then click back on to the first record.

I assume that there is something wrong with the requery.

I have the following code in the On Current event of the 1st subform:

Expand|Select|Wrap|Line Numbers
  1. Sub Form_Current()
  2. ' This code created by Form Wizard.
  3.     Dim strParentDocName As String
  4.  
  5.     On Error Resume Next
  6.     strParentDocName = Me.Parent.Name
  7.  
  8.     If Err <> 0 Then
  9.         GoTo Form_Current_Exit
  10.     Else
  11.         On Error GoTo Form_Current_Err
  12.         Me.Parent![SubFMileageInfo].Requery
  13.     End If
  14.  
  15. Form_Current_Exit:
  16.     Exit Sub
  17.  
  18. Form_Current_Err:
  19.     MsgBox Err.Description
  20.     Resume Form_Current_Exit
  21. End Sub
  22.  
Any and all advice would be very much appreciated.

Shona
Nov 10 '10 #1
1 1166
TheSmileyCoder
2,322 Expert Mod 2GB
Quote:However, when you go back into the form and
Go back into the form from where? Where have you been and what where you doing? Depending on what you were doing (or not doing) in the meantime the Current might not execute.

2 things to suggest:
  1. Add a (temp) msgbox to your Current event, allowing you to see whether or not it fires at runtime.
  2. Use Private Sub Form_GotFocus() instead

    If neither of these work, you can try uploading the db and I can take a look at it.
Nov 11 '10 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: (Pete Cresswell) | last post by:
..DefaultView = Continuous Forms ..RecordSource = a query. While the form & subform are open, I can open up the .RecordSource query and see five records. If I insert a record, then re-open...
6
by: Wendy Powley | last post by:
I have a subform which represents a 1:N relationship with the main form. I would like to be able to read values from an external file, fill the subform with the values read & allow the user to...
12
by: MLH | last post by:
I have created two forms: frmBrowseNegsMainform and frmBrowseNegsSubform. I put a subform control on the first of these. The SourceObject property for the subform control is, of course,...
15
by: Joachim | last post by:
Hi, Als a beginner, I am looking for a way to show records My code is Private sub Connection( Dim odbconn_Pro As OleDbConnectio Dim odbcomm_Pro As OleDbComman Dim odbdare_Pro As...
4
by: rczuba | last post by:
Problem: Creating a Default Value for a field in a subform when a field in the subform & form match. I'm trying to create a payroll database for a small home business that I have that has had...
2
by: DeanL | last post by:
Hi everyone, I have a subform in datasheet view that is used to display the contents of a single table. I have another subform with a query feeding it to give a count of how many particular...
1
by: Steve | last post by:
I have to tables Table1 IMS_ID IMS_Name IMS_Descript Table2 P_IMS_ID P_IMS_Name P_IMS_Descript
1
by: Crombam | last post by:
Hi to all, After searching the net for a couple of hours I just have to ask the question. How can I close a report with a subform (Pivot Chart) when this Pivot Chart is having no data? ...
4
by: luciegiles | last post by:
Hi, I would like to order the records in a subform frmSub by the field 'ReferralDate' (short date) so that the most recent record appears first. I'm sure this must be fairly simple but I can't get...
4
by: Kelly Warden | last post by:
I have a search form with a sub data form. When i search for "john" for example I should get a bunch of records in my subform, however it is just showing the first one from the table. Here is the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.