Tab from Main Form to Subform and back to Main Form

Hi,

I hope I can explain this clearly. I have a "Main" Form. This Form has two Subforms (A and B). The Subforms I put in a tab control (Subforms are independent of one another and are only linked to the Main form). What I want to do is hit the tab key and cycle from my Main form fields to the Subform A field one. Once I reach the end of Subform A I want to be able to tab to the beginning of Subform B. When I reach the end of Subform B I want to hit the Tab button and set the focus to a command button (cmdAddRecord) which is in the Main form. I have tried coding using the setfocus however when I am in subform A I cannot get it to set the focus to subform B. Olso subform B will not set the focus back to Main Form. I am stuck in subform A hitting the tab button. I have Access 2000 and unfortunately I do not see an upgrade in future. I know using the mouse will solve the problem however that slows down the data entry people. I would like to thank you for your help in advance. Any suggestions are very much appreciated.

Side note- If I take off the navigation buttons on the subforms I keep tabbing on the same record and cannot go the next form. Else I have the navigation buttons on the subforms I tab to the next record of that subform. End if (sorry just a little VB humor)

Edgar


Post your answer or comment

comments powered by Disqus
I need to add data from main form to a table and data to be seen immediately in subform in datasheet view. From time to time I need to delete a record from subform and data should be upadatet immeditale in subform.. I dont want to use split from...Any example please..
Thanks a lot

I need to move a value from a main form to subform so that i can use it in a calculation in the subform. the subform is derived from a table. How can i do this?

I am in a subform, and want to copy some data from a control on the 'main' form, to the subform, on a button click. How do I do that? This doesn't work:

Me.txtSUBCONTROL = [MAINFORM].Form![txtMAINCONTROL]

Also, on the same button click, how do I blank the data in the control on the main form? The button is on the subform.

Thank you!
Robert

hi,
i am newbe of access.
my prob is at 1st i want to add Multiple data from main form to sub form based on date. after input all data (which will show on sub form) i want to save it on table. i want to put add button on main form and save button on sub form.

Hello,
I have problem to pass identity value from main form to other forms in Access 03 database. I am sure this is simple for most of you but I am stumped.
I have one main form BASELINE, and subsquent forms like FOLLOWUP, MEDICATIONS etc that need to carry over patient Id, initials to the subsquent forms. if record not in BASELINE, it not allowed in other forms.
The patient ID passed successfully, not initials didn't work, when i open the other form , it always showed Compile error Sub or Function not defined with FixMe highlighted
I have the following code:

Private Sub Form_Current()
If Not IsNull(Me.[HiddenPatN]) Then
Dim per As String
per = Me.[HiddenPatN].Value
Me.PN.Value = per
Dim vv As Variant

vv = DLookup("[Initials]", "Baseline", "[PTNTNM] = '" & per & "'")
Me.ini.Caption = FixMe(vv)
Else
Me.PN.Value = ""
Me.ini.Caption = ""
End If

End Sub

Any one could help me to fix the problem.
Thanks lot!

Hi,

I want to synchronize a main form to a pop up form.
I have seen many examples of main form to subform, and subform
to subform, but I don't think that provides enough for me to
logically think out what's needed to synchronize my main form to my
pop up form.

Please help,
Thanks,
Jim

I have a form "frmOfProdInput" with a combo box "Combo4" to select an employee which fills a field "EmpName" on the main form

I also have a tabular subform "frmProdInput" which contains a field "EmpName.

I'd like to have the EmpName value on the main form fill the EmpName field on the subform when a new record is entered.

The main purpose is to select an employee from a combo box and input production data in the tabular form for that employee without entering the employee name to each record.

Is there a better/easier way to accomplish this?

Thanks.

I have one remaining issue with my current project. Was hoping someone might have a suggestion.

I have two tables. tblClientGeneral and tblAssetTags. Linked 1-Many on Client_Id.

Main form, frmClientGeneral it pulls Client_id and Client_name, there is a also a subform frmAssetList which shows all assets for said client.

Here is the issue. If there are no assets for that client yet, the client_id in tblAssetTags is not populated, since there are no records. So when I open my add client asset form from the subform with a command button passing the client_id to that form, it's empty. hence the asset i'm adding has no idea where to go.

So what is the best solution here? Should i set client_id on the frmAssetList to = the value of Clinet_id from the frmClientGeneral if so how? Or is there a better way to go about this. Or do I pass the client_id straight from the frmClientGeneral and not the subform.

Thanks
Bruce

I need to write VBA code to transfer information from a main form to one of its subforms if a condition equates to true. I would do this bit with the OnUpdate event of one of the controls in the main form and using If Then Else.
The problem is that the subform is tabular, and I find that anything which is transferred to it appears the same on all lines. I want to keep automatically adding new lines with the information from the main form in which each line in the subform is different.
Is this possible in Access 97?

As per the title, I am working with issues pertaining to tab control between the main and subform.

When the form is initially opened, the tab (focus) commences on the first field of the subform.

1. I would rather it start on the first field of the main (in form header)

2. After entering data in this field on Main form, when I press the tab key it does not go anywhere. At this point I would like it to go into the subforms (first field).

Do I need to create macros for these events to function as desired?

I have double checked all of the tab settings per each item and all appears to be correct. What am I missing now?

Hi all,


I have a basic DB that has 2 forms, one a sub form of another. Now In the main form I have the 2 feilds Artist ID (PK) and Artist. In the Subform I have several other feilds. Now when I tab through in the mainform and enter data for Artist then the next tab takes me to the sub form, which is OK, but it takes me to the next record, so the data for Artist X is in the record following Artist X name and ID.

Is that clear? Now, how do I stop it going over to the next record when I tab into my sub form?

Thanks


Sebby

I have a main form frmAddDoc with a field txtTitle and a subform subfrmReference that loads from the main with an on_click event button. I have a field txtTitle in the subform that should be assigned the value txtTitle from the main when the form is loaded from the on_click event of the main. Can someone please provide to me an example of code that would do this? I haven't done it in such a long time and my syntax is just not working.

Bottom line: I want subtxtTitle in the subform to equal the value of txtTitle from the main form.

Me!subfrmReferences.Form!subtxtTitle = Forms![frmAddNewDoc]![txtTitle].Value

????

Anyone anyone?

Hi All.... I have a database with 3 tables ( employee, topic & training ) and 2 forms. On my Main form ( training ) I have 2 combo boxes for the user to select the employee name which is based on the employee table. I have a sub form ( training sub ) based on the training table, which is a continues form that has a combo box which is based on the topic table which they select the training coarses that they have taken. My problem is getting the employee info to save to my training table. It saves all the data except the employee info. I have tried doing a hidden field which gets the info from the main form but will not save iit to the table. Im not sure how good I explained this so I have attached a copy of it. Any help would be great as I am at a total loss.

Thanks Don

heya, can someone please help me?

right, so i have a form which i made. and there is a sub form.

i have created a drop down list with - 0% 5% 10% 15% and 20%, on the mainform
i added a new column to the sub form and put =[combo42] because this is what the combo box was called
but it says #name?

HELP HELP HELP !!!!!!!
i need the value to appear in the sub form table when i select it from the drop down list

so i like need to know how to link a combobox from the main form to the subform so whatever you select appears there.
thanksssssssssssssss.

Hi..me again..
Another query...I have a text box called 'ProjectNo.' on my main form, and once I hit my button to create my subform I want what i entered into 'ProjectNo' on my main form to appear on the subform....automatically, instead of having the user insert the projectNo twice...possible??

Cheers

nia

As the header says, I want to tab through my main form, into a subform, through the subform (no problem all done using the tab order), and then back into the main form at the next field in the tab order, any ideas.

Hi!
I've developed a big main form with subforms on. All'n all there are lots of controls on all these forms. (4 subforms in the "main" form).

As I've added controls now and then, they are not added in order from top left to bottom right.

Anyone know if I can set taborder even for the subforms?

Cause now, the tab-order is bad.

Thanks for any help

How can I achieve this? I've got a subform with a specific combo box in it. Depending on a selection in the parent/main form, I would like to update the combo box according to that value.

I populate the combo box's row source is as follow in the OnCurrent event:

	Code:
	Me.cboReturnLineType.RowSource = 
"SELECT ODS.Return_Line_Type.Return_Line_Type_ID, ODS.Return_Line_Type.Return_Line_Type_Name 
FROM ODS.Return_Line_Type 
WHERE Return_Type_ID = " & ReturnType & " 
ORDER BY Return_Line_Type_Name"

Not sure using a global variable is the way to go but I've declared a ReturnType variable as "Public ReturnType as Integer" on the parent form and I've assigned it a value.

How can I force my code to pick up the global variable's value? And is it at all possible to pass a value between forms and subforms?

I've also tried using [Forms]![frmReturn_Header]![cboReturnType] to point to the specific field:

	Code:
	Me.cboReturnLineType.RowSource = 
"SELECT ODS.Return_Line_Type.Return_Line_Type_ID, ODS.Return_Line_Type.Return_Line_Type_Name 
FROM ODS.Return_Line_Type 
WHERE Return_Type_ID = 
" & [Forms]![frmReturn_Header]![cboReturnType] & " 
ORDER BY Return_Line_Type_Name"

without any luck.

I have a main form (PackFRM) with a subform. On the main form the user is to select a "pack" then on the subform (ItemSFM) the user will select the "items" to be added to the "pack".

The main form is unbound and based on a query of the pack table. Once the user selects the pack name from a combo box, related information is displayed, including the pack number (PackID). The pack number is displayed in a text box that is based on a column of the query of the pack name combo box.

Then the user tabs to the subform, which is bound to the combination table, and there selects the item (ItemID) and enters the quantity (Quantity).

The bound table for the subform has 3 fields, the pack number (Pack ID), the item number (ItemID) and the quantity (Quantity). The item number and quantity are included on the subform but the pack number is on the main form. How can i get the record of the subform to save and include the pack number from the main form?

Sue

There are 3 words that are dangerous a staff meeting:
Can you do?
Is this possible
Why can’t we
Then why do I say, “It most likely can be done”.

This is what I am trying to accomplish.
I have a form with a subform. I would like to populate a field in the subform, from the Main Form.

The field in the Main Form is called EDRate.
The field in the Subform is called DRate.
The subform is called FrmWorkProduction subform.
The Main form is called Frm ADD/Edit Payroll S3
In the Main form I used the After Update and used the following:
Private Sub EDRate_AfterUpdate()
Me.FrmWorkProduction SubForm!DRate = Me.EDRate
End Sub

I get error the recordset is not updateable

I know what it means, (it has to do with my relationships) but I can’t figure out what is the best way to fix.

The subform:
Link Fields are as follows:

Link Master Fields: ID
Link Child Fields: wrkdescp_ID


I will attach the db, to help understanding the problem.

Thanks all for taking the time to take a look and view

O yes the next time, I will keep my mouth shut!!!!!!!!!

Hi guys,

Ok, this is what I have:

I have setup my main form with 2 subforms to mimic a split form; this works fine.

To search for a record, I am using a cbo on the main form which I would like the user to select from. Once selected, then this will populate the first subform.

This is the code I have for the cbo:


	Code:
	Dim intAnswer As Integer
 
     If IsNull(Me!cboCaseNoCFDWit) Then Exit Sub
    With Me!sfFocus.Form.RecordsetClone
      .FindFirst "Me!sfFocus.Form!CaseNumber = """ & Me!cboCaseNoCFDWit & """"
      If Not .NoMatch Then
         If Me.Dirty Then Me.Dirty = False
         Me!sfFocus.Form.Bookmark = .Bookmark
      Else
         intAnswer = MsgBox("The Case Number was not found! Do you wish to add a Focus to PSU Case Number """ &
Me!cboCaseNoCFDWit & """ ", vbYesNo + vbInformation, "Case Number Not Found")
            If intAnswer = vbYes Then
                DoCmd.GoToRecord , , acNewRec
                txtCaseNumber = "" & Me!cboCaseNoCFDWit & ""
            Else
                Exit Sub
            End If
 
      End If
    End With

I get an error at the .findfirst; states that the Microsoft Engine does not recogize Me!sfFocus.Form!CaseNumber

And the reason I am not using a regular split form is because I cannot, for the life of me, get the form to the size that I want. The splitform works great with the code above (a few changes to it of course), but the bottom of the splitform (datasheet) is too long and I cannot shorten it.

Hello.

I have a form (Frm1) with a subform (Subfrm1). Both Frm1 and Subfrm1 have tabs. When I select a tab in the subform, I would like to write VBA code to select a specific tab on the main form.

So, In Frm1, I have TabCtl10 with Page11 and Page12.
In Subfrm1, I have TabCtl20 with Page21 and Page22.

If I select Page21 in the subform, I would automatically like Page 11 in the main form to appear.

I have tried the following as an "on click" event when selecting Page21, and it doesn't work:

Forms("Frm1")!Controls(TabCtl10)!Pages(Page11).Set Focus

Thanks in advance.

Hi there,
I have a query in my subform:

	Code:
	SELECT ContainsTracks.albums, ContainsTracks.tracks
FROM ContainsTracks
WHERE ContainsTracks.albums LIKE [VALUE IN TEXTBOX1 FROM MAIN FORM]

As you can see in the brackets, I would like to use the value in textbox1 on my main form in this query (so I can select only the tracks from the album that is typed in textbox1, disregarding the others).

How can this be done?

Thank you for your time guys,

I have a main form that has some sub forms on it linked by master child on PK. When I select a new record on the sub forms I want to take a date value from the main form and populate the value into a field in the sub form. How do I do this as I cannot see a new record event on the sub form?

help would be much appreciated.
regards

Peter


Not finding an answer? Try a Google search.