473,387 Members | 1,863 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,387 software developers and data experts.

Creating continuous forms

18
I have a main form which has a Comment Area Section whose source object is a form fsubCaseDetails.
fsubCaseDetails has a textbox.The main form which when viewed in form view displays the fsubcaseDetails form in the Comments Area section.
I need to enter comments into the form fsubCaseDetails by clicking on the AddComments button which opens a form frmZoom.When a user clicks on AddComments button frmZoom is opened and he/she enters the comments into the textbox of frmZoom and finally the comments entered in the frmZoon will get transfered to form fsubcasedetails on clicking save button of frmZoom.
When the text get transferred into fsubcasedetails form,it will get locked and wiil not allow any further comments to be entered.
When some text get transferred to fsubcasedetails form,another fsubcasedetails will get opened in the Comment Area section below the first form.
If now a user wants to add some comments by opening the frmZoom,the text comments should get transferred to the 2nd fsubcasedetails form which got created.Similarly the process wll go on.

Could anyone please help me in the above problem.
Specifically how continious forms will be created and the text will get transfered to the next next forms.
This is very urgent.

Thanks.
Sep 22 '08 #1
30 3133
NeoPa
32,556 Expert Mod 16PB
This is really quite unclear. Items are not introduced in any understandable order.

The best I can do with this is to provide a possibly helpful link on Referring to Items on a Sub-Form.
Sep 23 '08 #2
bibek24
18
This was not really helpful.Let me explain the scenario more clearly.

Logging into my application brings me into frmMain where it displays certain cases.
Clicking on any particular case,"frmCase" is opened.
This form frmCase has many tabs among which "File Details" is one.
Clicking on "File Details" tab, a screen appears which has a "Comment Area" section inside which there is continuous form "fsubCaseDetails".

I need to enter comments to the form "fsubCaseDetails" through a form frmZoom.frmZoom will get open on clicking a button "Add Comments" which is present in frmCase.

What I need to do so that the comments entered in the frmZoom will get transferred to fsubcasedetails on clicking "save" button of frmZoom.
Sep 25 '08 #3
FishVal
2,653 Expert 2GB
Hello, bibek.

You may read the similar threads:
Pop Up Form to Enter Data, then Close and Requery Main Form
Returning Data from Modal Form
make one form wait for another

Regards,
Fish
Sep 25 '08 #4
NeoPa
32,556 Expert Mod 16PB
This was not really helpful.Let me explain the scenario more clearly.
That would be a good starting point yes.

Now, I get that when you say tab you're referring to a Page control, but would I be right in guessing that your "Comment Area" section refers to a SubForm control (as opposed to the form contained within it - see earlier link for details)?

fsubCaseDetails must be the name of a form which is displayed within the SubForm control in continuous mode. frmZoom is an independent form which is merely linked logically by code.

Can you please confirm this understanding, and possibly post the code you use ( The full procedure please) to open frmZoom.
Sep 25 '08 #5
bibek24
18
What you have understood is perfectly correct.
Let me give you more inputs as well.

Here fsubCaseDetails(Row Source is a query) is a subform in frmCase.
The textbox in fsubCaseDetails is locked that means user doesn't have the ability to directly enter into it.

A user can only enter text to it if he/she clicks on "Add Comments" button (present in frmCase) which opens frmZoom(a zoom view to fsubCaseDetails).
Anything entered in the frmZoom shoud get transfer and saved in fsubCaseDetails when the "Save" button of frmZoom is clicked.

After clicking Save, if the user wants to add some more comments then he/she has to click again the "Add Comments" button which would pop up the frmZoom and the text entered should get transfer to the 2nd row of fsubCaseDetails.
The problem is that after writing some text to frmZoom and clicking Save button,its not getting transfer to fsubCaseDetails.I might be missing some code in events of both of the forms such as open event,Activate event,Load event etc.

I need to know what code would solve my requirement.
Oct 1 '08 #6
NeoPa
32,556 Expert Mod 16PB
That is a lot clearer, but I would still like to see your code for this.

This means that I can see better what you already understand, and concentrate on the gaps.
Oct 1 '08 #7
bibek24
18
Code for Save button in frmZoom:
========================
Expand|Select|Wrap|Line Numbers
  1. txtEntered = Me.txtZoom.Value
  2. Forms![frmCase]![fsubCaseDetail].Form![txtDetails] = txtEntered
  3. DoCmd.Close acForm, Me.Name
where txtEntered is a global variable.

I am new to VB Access and need to know on a high level what all codes are required for my requirement.
Oct 1 '08 #8
NeoPa
32,556 Expert Mod 16PB
This code isn't perfect, but it's pretty adequate. If it's executed it should at least update your calling form with the latest data from frmZoom.

Is this not happening at all?
Oct 2 '08 #9
NeoPa
32,556 Expert Mod 16PB
Some better code, if you want to add data in to subsequent lines if frmZoom is repeated :
Expand|Select|Wrap|Line Numbers
  1. With Forms![frmCase].[fsubCaseDetail].Form
  2.   .[txtDetails] = .[txtDetails] & vbCrLf & Me.txtZoom
  3. End With
  4. DoCmd.Close
This assumes txtDetails can expand to show multiple lines. I hope at this stage you're not referring to multiple records on your main form ([frmCase]), that would change the question entirely and to have left out explaining that would be, well, certainly not clever.
Oct 2 '08 #10
bibek24
18
Hey I would just like to know what code would pass the text from frmZoom to fsubCaseDetails on clicking the "Save" button of frmZoom and after doing it ,the form should exit.

My code is not passing the value and not closing the form as well.
Oct 3 '08 #11
FishVal
2,653 Expert 2GB
Hey I would just like to know what code would pass the text from frmZoom to fsubCaseDetails on clicking the "Save" button of frmZoom and after doing it ,the form should exit.

My code is not passing the value and not closing the form as well.
Hi.

The code you've posted in msg #8 is expected to do something or at least fail with error message. If nothing happens, then I would like to ask:
- Do you have any error handling code?
- Are you sure the code runs?

Regards,
Fish.
Oct 3 '08 #12
bibek24
18
Ya the code is showing the following error:
Access cann't find the field fsubCaseDetails reffered to in your expression.

Let me tell the you the existing scenario as well.
In the existing scenario the frmZoom is opened by double clicking the text box of fsubCaseDetails.
But in the TO-BE scenario the text box in the form fsubCaseDetails should be locked and the user should only add comments to it by clicking on "Add Comments" button which would open frmZoom.

Can we modify the following existing code and meet our requirement?
One more thing there is no code associated with the "Save" button of frmZoom which could ensure the value passing from it to fsubCaseDetails.
I think the data is also passed through the following code.I am not getting the code clearly.If you can explain it and find out a way, then it would be great.

Opening of frmZoom on double clicking the text box of fsubCaseDetails:
================================================== =
Expand|Select|Wrap|Line Numbers
  1. Private Sub txtCaseDetails_DblClick(Cancel As Integer)
  2.    On Error Resume Next
  3.    gfncZoomWindow (Me.NewRecord = False)
  4. End Sub
Function to open Zoom window:
=======================
Expand|Select|Wrap|Line Numbers
  1. Function gfncZoomWindow(Optional blnLock As Boolean)
  2.    'Open Zoom Window With Contents Of Active Text Box Control
  3.    On Error Resume Next
  4.    Dim frm As Form      'Active Form
  5.    Dim strFormName As String
  6.    Dim blnLockEdit As Boolean
  7.  
  8.    If Not IsMissing(blnLock) Then blnLockEdit = blnLock
  9.  
  10.    If IsError(Screen.ActiveForm) = False Then
  11.       Set frm = Screen.ActiveForm
  12.  
  13.       If frm.ActiveControl.ControlType = acSubform Then
  14.          If frm.ActiveControl.Form.ActiveControl.ControlType = acTextBox Then
  15.             'Tack . At End To Denote Subform
  16.             DoCmd.OpenForm "frmZoom", , , , IIf(blnLock = True, acFormReadOnly, acFormPropertySettings), acDialog, frm.Name & "."
  17.          End If
  18.       ElseIf frm.ActiveControl.ControlType = acTextBox Then
  19.          DoCmd.OpenForm "frmZoom", , , , IIf(blnLock = True, acFormReadOnly, acFormPropertySettings), acDialog, frm.Name & "."
  20.       End If
  21.    End If
  22. End Function
Oct 3 '08 #13
FishVal
2,653 Expert 2GB
Ok.

That is half of the puzzle. Could you post all the code in [frmZoom] module?
Oct 3 '08 #14
bibek24
18
Here it is:

Expand|Select|Wrap|Line Numbers
  1. Option Compare Database
  2. Option Explicit
  3.  
  4. Dim mfrm As Form              'Active Form
  5. Dim mblnCancel As Boolean     'Indicates Cancel Pressed
  6.  
  7. Private Sub cmdCancel_Click()
  8.    On Error Resume Next
  9.    DoCmd.SetWarnings False
  10.    DoCmd.RunCommand acCmdUndo
  11.    DoCmd.SetWarnings True
  12.    mblnCancel = True
  13.    DoCmd.Close acForm, Me.Name
  14. End Sub
  15.  
  16. Private Sub cmdSave_Click()
  17.    On Error GoTo Err_cmdSave_Click
  18.  
  19.    txtEntered = Me.txtZoom
  20.    Forms.fsubCaseDetails.txtDetails = txtEntered
  21.    DoCmd.Close acForm, Me.Name
  22.  
  23. Exit_cmdSave_Click:
  24.    Exit Sub
  25. Err_cmdSave_Click:
  26.    MsgBox Error$, vbCritical, "Error: cmdSave_Click"
  27.    Resume Exit_cmdSave_Click
  28. End Sub
  29.  
  30.  
  31. Private Sub Form_Open(Cancel As Integer)
  32.    On Error GoTo Err_Form_Open
  33.    Dim varOpenArg As Variant        'Value Of Open Argument
  34.    Dim ctl As Control
  35.    Dim lngAddHeight As Long         'Add Height Of Detail Section
  36.    Dim lngPos As Long
  37.  
  38.    'Set Initial Height
  39.    DoCmd.Restore
  40.    DoCmd.RunCommand acCmdSizeToFitForm
  41.  
  42.    'Set Module Form Variable
  43.    varOpenArg = Me.OpenArgs
  44.    If Not IsNull(varOpenArg) Then
  45.       If InStr(1, varOpenArg, ".") Then
  46.          lngPos = InStr(1, varOpenArg, ".")
  47.          If lngPos > 0 Then
  48.             Set mfrm = Forms(Left(varOpenArg, lngPos - 1))
  49.             Set mfrm = mfrm.ActiveControl.Form
  50.          Else
  51.             Set mfrm = Forms(varOpenArg)
  52.          End If
  53.       Else
  54.          Set mfrm = Forms(varOpenArg)
  55.       End If
  56.  
  57.       Me.txtZoom = mfrm.ActiveControl.Value
  58.  
  59.       'Set The Locked Property To Match The ActiveControl Locked Property
  60.       If mfrm.ActiveControl.ControlType = acTextBox Then
  61.          Me.txtZoom.Locked = mfrm.ActiveControl.Locked
  62.       End If
  63.       SendKeys "{F2}"
  64.    End If
  65.  
  66. Exit_Form_Open:
  67.    Exit Sub
  68. Err_Form_Open:
  69.    MsgBox Error$, vbCritical, "Error: Form_Open"
  70.    Resume Exit_Form_Open
  71. End Sub
  72.  
  73. Private Sub Form_Unload(Cancel As Integer)
  74.    On Error Resume Next
  75.    If mblnCancel = False Then mfrm.ActiveControl.Value = Me.txtZoom
  76. End Sub
Oct 3 '08 #15
NeoPa
32,556 Expert Mod 16PB
Hey I would just like to know what code would pass the text from frmZoom to fsubCaseDetails on clicking the "Save" button of frmZoom and after doing it ,the form should exit.

My code is not passing the value and not closing the form as well.
Hey, if you'd responded to post #9 then I'd have known the exact situation we're dealing with. If you leave me guessing instead of responding clearly, you can expect me to be unclear as to exactly what IS going on.

Even after your less than polite reply, you STILL haven't answered half the questions posed of you and your situation is STILL unclear.
Oct 3 '08 #16
NeoPa
32,556 Expert Mod 16PB
Ya the code is showing the following error:
Access cann't find the field fsubCaseDetails reffered to in your expression.
You're telling us this in post #13!! Have you given ANY consideration to this question? I suggest if you want some help, you pay more attention to those trying to help you, rather than showing attitude when they can't read your mind.
Oct 3 '08 #17
NeoPa
32,556 Expert Mod 16PB
Ya the code is showing the following error:
Access cann't find the field fsubCaseDetails reffered to in your expression.
This is very confusing as the code you posted earlier (post #8) is quite different from the code you subsequently posted (post #15 - lines #19 to #21). There is also no indication as to which line triggers the error message shown.

I shall will await your response.
Oct 3 '08 #18
FishVal
2,653 Expert 2GB
@bibek24

The code you have is kludgy and unreasonably complicated.
Since the question was several times asked on the forum I've written a simple howto concerning different approaches to the problem.

Regards,
Fish
Oct 3 '08 #19
bibek24
18
The code in #8 is showing the error which is my TO BE code as per my requirement.
All other subsequent codes are for the existing scenario.
My requirement is to enhance the existing scenario and what I have explained in #13 is the existing scenario.
Oct 3 '08 #20
NeoPa
32,556 Expert Mod 16PB
@Fish, Did you mean to post that in VB / VBA HowTo section? I would have thought this was Access specific.

PS. Nice article :)
Oct 3 '08 #21
FishVal
2,653 Expert 2GB
@Fish, Did you mean to post that in VB / VBA HowTo section? I would have thought this was Access specific.

PS. Nice article :)
:)

I intended to post it in Access howtos section but accidentally posted it in VB/VBA one. Please, move it appropriately.
Oct 3 '08 #22
NeoPa
32,556 Expert Mod 16PB
The code in #8 is showing the error which is my TO BE code as per my requirement.
All other subsequent codes are for the existing scenario.
My requirement is to enhance the existing scenario and what I have explained in #13 is the existing scenario.
Bibek,

As Fish has already posted a fairly comprehensive article on the subject I will assume all your questions are resolved for now. I will content myself with a comment I was leading up to before, depending on one of the answers I was anticipating :
Sometimes, code can be inactive (remain untriggered) even if the code is perfectly correctly done, simply because the property of the object (I'm referring to the On Click of a Command Button for example or the On Open of the form itself even) is not set to the value "[Event Procedure]". This is found when looking at the object in Design View and showing the Properties (Alt-Enter).

If you find, after going through Fish's article that you still have questions then please come back and post them.
Oct 3 '08 #23
NeoPa
32,556 Expert Mod 16PB
:)

I intended to post it in Access howtos section but accidentally posted it in VB/VBA one. Please, move it appropriately.
Moved :)
Oct 3 '08 #24
bibek24
18
The approach looks good.Thanks for this.
But I have the following questions:

1) I am always getting a debugging error when am trying to refer a subform in the main form.

for exp
With Forms!frmChild1
.txb.ControlSource = Me!fsubCaseDetails.Form!txb.ControlSource

2) To overcome this I kept the "Add Comments" button in the subform itself and tried with the same code as posted

With Forms!frmChild1
.txb.ControlSource = Me.txb.ControlSource

It was working fine but this always update the first record in the form,the control is not moving to the 2nd record.
So how to move the control to 2nd record once the 1st record has been saved?
Oct 6 '08 #25
FishVal
2,653 Expert 2GB
....
It was working fine but this always update the first record in the form,the control is not moving to the 2nd record.
So how to move the control to 2nd record once the 1st record has been saved?
As soon as both forms are bound to the same Recordset object, they will be always pointed to the same record.

Regards,
Fish.

P.S. I didn't really understand your question.
Oct 6 '08 #26
NeoPa
32,556 Expert Mod 16PB
As this refers directly to Fish's code (in the article) I will allow Fish to respond.

If you hear nothing after a couple of days then bump the thread and I will have a look into it myself.

PS. How did he do that :S
Oct 6 '08 #27
bibek24
18
I mean to sat how to point to the 2nd record of the form once the 1st record is saved.Suppose I want to enter something to the 2nd record then how to do that?
Oct 6 '08 #28
FishVal
2,653 Expert 2GB
As I've already said both main and child form being bound to the same Recordset object are pointed to the same record, no matter where do you click navigation buttons.

Option 1. (as in the example)
Select appropriate record on main form, open child form, alter data and either submit or cancel input.

Option 2.
Add navigation bar to the child form. When child form is opened you may use its navigation bar to walk through records.

Hope this helps.
Oct 6 '08 #29
bibek24
18
I am sorry but I am really not getting help for my requirement which is as follows:

As many number of times the child form will be populated with some text and clicked on "Submit" button that many number number of records would be created in the parent form.

i.e First text entered to the child form would make up the first record in the parent form,second would make up the 2nd record and so on.
Oct 7 '08 #30
FishVal
2,653 Expert 2GB
I am sorry but I am really not getting help for my requirement which is as follows:

As many number of times the child form will be populated with some text and clicked on "Submit" button that many number number of records would be created in the parent form.

i.e First text entered to the child form would make up the first record in the parent form,second would make up the 2nd record and so on.
Hello, bibek.

I thought it is quite straightforward - when you need to do the same on usual form, you simply go to new record, enter data, go to new record and so on.

That means, the only thing [Submit] button has to do is to point child form to new record. For example using DoCmd.GoToRecord method.

Kind regards,
Fish.
Oct 7 '08 #31

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

Similar topics

2
by: Iain Miller | last post by:
Now this shouldn't be hard but I've been struggling on the best way as to how to do this one for a day or 3 so I thought I'd ask the assembled company..... I'm writing an application that tracks...
5
by: Armando | last post by:
I recently saw the tail end of a "Continuous forms" discussion, but not enough was available to see if this will be a PITA repeat question. Sorry if it is. On a form with its Default View...
6
by: Rose | last post by:
I have set my form's default view property to continuous forms and have added a field for the table columns I wish to view. What do I need to do to allow more than one record to show at the same...
3
by: Richard Hollenbeck | last post by:
I have the following query in my form's code: Private Function Get_Data(fieldNum As Integer) Dim strSQL As String Dim db As DAO.Database Dim rs As DAO.Recordset strSQL = "SELECT & "", "" & ...
9
by: Edwinah63 | last post by:
Hi everyone, Please let there be someone out there who can help. I have two BOUND combo boxes on a continuous form, the second being dependent on the first. I have no problem getting the...
2
by: panwala_bhavesh | last post by:
Thanks in advance... I have a form displaying the results of a query in a continuous form style. I want to be able to double-click on the key field of the form (a textbox, in this case a AssetID)...
5
by: Michael R | last post by:
Searching the net I've found a simple technique to add row numbers and alternate colors (for the even and the uneven row) to a continuous form. 1st step: Create a textbox, send it to background...
1
by: rpboll | last post by:
I am looking for the best way to accomplish the following continuous forms concept. There are Five Groups: A, B, C, D, E Each group has eight Members: a, b, c, d, e, f, g, h Each...
6
by: dufnobles via AccessMonster.com | last post by:
I have a form that excepts text input from a user. I would like to have the form display the same line several times so that the user can enter several different responses on one form screen. ...
8
by: Steffen Beck | last post by:
Hi NG I need some help with a problem on my forms. If I have 2 related tables, for instance companies and employees, and want to display all companies on a continuous form with their...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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
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
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...

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.