473,397 Members | 2,116 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,397 software developers and data experts.

Manual split form as a subform

Seth Schrock
2,965 Expert 2GB
I'm aware that true split forms can't be set as subforms and retain the split form functionality. What I'm trying to do is use two subforms to act like a split form. My main problem is that I want the moving between records in one to be mirrored in the other, preferably working both ways. I had initially tried
Expand|Select|Wrap|Line Numbers
  1. Me.Parent!frmDT_Stage1_SF.Form.FindFirst "LevelID = " & Me!LevelID
I got an error number 2465 - "You Entered an expression that has an invalid reference to the property |. The property may not exist or may not apply to the object you specified." Thinking that it was because there wasn't a control linked to the field LevelID in the other subform, I added it and made it invisible and then ran my code again. The error changed to number 2455 - "Microsoft Access can't find the field '|1" referred to in your expression. You may have misspelled the field name, or the field may have been renamed or deleted." I then tried the following code and got the same error.
Expand|Select|Wrap|Line Numbers
  1. Me.Parent!frmDT_Stage1_SF.Form.Recordset.FindFirst "LevelID = ID & Me!LevelID
There has to be a way to do this, but I can't think of what to try.
Apr 2 '13 #1
6 4538
zmbd
5,501 Expert Mod 4TB
Seth, you've lost me a tad here:
Do you have:
form_parent
subform_child_1

Or

form_parent
subform_child_1
subform_child_2

Or

form_parent
subform_child_1
subform_to_child_1_child_2

or what?

Your code looks like the first set of forms I gave; however, your question seems to point to the second set of forms listed.
Apr 4 '13 #2
Seth Schrock
2,965 Expert 2GB
Second set if tables. When I Chang records in subform 1, I want it to go to the same record in subform 2.
Apr 4 '13 #3
Seth Schrock
2,965 Expert 2GB
Back working on this again. Here is what I have tried now. I setup a sub that would work for multiple forms and then just pass it the information that it needs. My idea was to get out of having to reference the subform through the parent form.
Expand|Select|Wrap|Line Numbers
  1. Public Sub MoveRecord(NewRecord As Long, Stage As Integer, CurrentFormType As String)
  2. On Error GoTo Error_Handler
  3.  
  4. Select Case Stage
  5.     Case 1
  6.         Select Case CurrentFormType
  7.             Case "CF"
  8.                 Forms!frmDecisionTreeWizard!frmDT_Stage1_SF.Form.Recordset.FindFirst "LevelID = " & NewRecord
  9.  
  10.             Case "SF"
  11.                 Forms!frmDecisionTreeWizard!frmDT_Stage1_CF.Form.Recordset.FindFirst "LevelID = " & NewRecord
  12.  
  13.         End Select
  14.  
  15.    Case 2
  16.  
  17. End Select
  18.  
  19. Exit_Procedure:
  20.  
  21.     Exit Sub
  22.  
  23. Error_Handler:
  24.     Call ErrorMessage(Err.Number, Err.Description, "modDecisionTreeWizard: MoveRecord")
  25.     Resume Exit_Procedure
  26.     Resume
  27.  
  28. End Sub
I then call it with the following code
Expand|Select|Wrap|Line Numbers
  1. MoveRecord Me!LevelID, 1, "CF"
I'm getting the following error on line 8: Error Number 2455 - You entered an expression that has an invalid reference to the property Form/Report.

I'm not sure what is wrong with the reference.
Apr 7 '13 #4
zmbd
5,501 Expert Mod 4TB
Expand|Select|Wrap|Line Numbers
  1. '<removed some code here>
  2.    '
  3.    Dim zsrs As DAO.Recordset
  4.     '<removed some code here>
  5.     '
  6.     'setup to restrict events.
  7.     Set zsrs = Me!sfm_qry_asset_inventory_logbook.Form.Recordset
  8.     zsrs.MoveLast
Forces my subform to move to the last record in the default sort order.
Apr 9 '13 #5
Seth Schrock
2,965 Expert 2GB
Finally! I have figured out what was staring at me in the face. I was getting the error when I was loading the form. Because I have two subforms on the same main form and I have put the same code in each subform's OnCurrent event. What is happening is that the one subform is being loaded before the second. Thus when subform 1's OnCurrent event is running, subform 2 hasn't loaded yet and thus there is no Form inside the subform control. If I comment out the record move, open the form, and then uncomment the record move, it works perfectly. Now I need to come up with a way to keep my code from running when the form is opened, but still allow it to run when I'm changing records. Here are my ideas that I'm going to try:
1. Setup a global variable to act like a flag when opening the form, something like this
Expand|Select|Wrap|Line Numbers
  1. intFlag = 1
  2. DoCmd.OpenForm...
  3. intFlag = 0
I could then test for the flag value in the forms' OnCurrent events.

2. I had an idea, but then I realized that it wouldn't work, so I guess I only have one idea so far.

If you think you have a better solution, please let me know. The main form will only be opened from one button and that button only. I will have at least one other set of subforms paired together like this on a different tab on the same main form, so I would need the solution to work for multiple connected sets of subforms.

Sorry it took me so long to get back with you on this Z. I'm only able to work on this database at work while I'm not on the clock because my mouse at home is about broke and designing a database with it requires about 10 undo clicks per change attempted :(. So I'm limited to weekends to work on this database.
Apr 13 '13 #6
Seth Schrock
2,965 Expert 2GB
My solution in idea 1 does work, so I can move on to work on my next problem, but I'm still open to ideas if there is a better way to do this.
Apr 13 '13 #7

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

Similar topics

0
by: Josh C. | last post by:
Hello everyone. I'm a bit of an Access newbie, so please bear with me. Please go to http://www.dumoti.com/access/ to view the database - 536kb. I'll go straight into examples: In the form...
3
by: Simone | last post by:
Hi All, I have a Find Record button setup in most of my forms in order to find a specific customer's details. I have just noticed today though that this search will only find the customer if it...
5
by: ego | last post by:
Hi all , I had created the following Form/SubForm structure : MainForm SubForm A (SubForm of MainForm) SubForm B (SubForm of SubForm A) SubForm C (SubForm of SubForm B) SubForm D ...
9
by: PC Datasheet | last post by:
I'm stuck on something that seems should be easy and I need some help. My main form has an option group with five options. My subform chooses from different lists depending on which option is...
10
by: Thelma Lubkin | last post by:
My form/subform combination that allows user to display 'ColorSet' records, move to other records via a selector, to add,delete, and edit them, and to manage the related 'Color' records from the...
3
by: ghat12 | last post by:
Hi, I have created a form containing 5 textfields/combo boxes and a command button to conduct searches for matching records. My results are currently displayed as a separate datasheet which is...
0
by: ARC | last post by:
Hello, I like the split forms in access 2007, because you can still do the header, and any tool buttons, yet have the datasheet look without the need for 2 forms (main form / subform). However,...
0
by: ARC | last post by:
I posted this before, but no response. Hopefully the MVP folks will know the answer. I'm not sure how other's are using the new split form, but what I like about it is I can design the header...
1
by: troy_lee | last post by:
I have a table (Table A). It has one field, a PK. It is in a 1:M with another table (Table B). I am having trouble with a form/subform setup to view the 1:M records. On the parent form, there is...
1
by: phill86 | last post by:
Hi, I am working in access 2007 and I have a split form that has the datasheet on the bottom in that datasheet I would like to show a subdatasheet which works fine in the undelying query but on my...
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: 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.