I have a main form with a subform which in-turn also has a subform (in datasheet mode). When the user clicks a button on the main form I want to disable all of the controls on the subforms. This works fine until the user clicks the button while the focus is on one of the text fields in one of the subforms. It rightly complains that the control can't be disbled while it is in focus. To circumvent this problem I've tried setting the focus to another field before disabling the control. However this doesn't seem to work. It seems to ignore the setfocus and still flags the original error. Is it not possible to set the focus of a subform from the main form?
I have a form with a button that when clicked triggers "find" in a field that is located on the form...
[code]Private Sub Command23_Click() DoCmd.GoToControl "last name" DoCmd.RunCommand acCmdFind
End Sub [code]
When the record is found and the user presses "esc" to close the find box I would like to set the focus in a field located in the subform...
[code] Private Sub Form_Current() Me.LT2DataEntrySubform1.Form!QRt.SetFocus End Sub [code]
Problem is after the user presses "Esc" both the field on the form that is used to seach on and the field in the subform that I set the focus on have the focus. Yes...both fields have focus and unless the user clicks on some other field no dataentry can be done.
Hi, For some reason when I set the focus to a text box in the subform it clears the textboxes there. First I set the values of 2 of the textboxes in the subform programatically. Then I tab to the last control in the main form. This is the code I have in the lost focus event of that control:
When I open the “FrmStudentEnrollment” form in the attached db and enter a license number in the License number field (this field is inside a subform) that is not in the db, the “FrmStudentInfo” form opens allowing student information to be entered. After entering student information in the “FrmStudentInfo” form I have a close command button to return to the “FrmStudentEnrollment” form.
This is where I need help! I would like, when returning to the “FrmStudentEnrollment” form for the focus to be on the “AttentDate1” field located in the subform “FrmStudentInfo”. I used the LicenseNo Combo Box NotInList VB from Northwind db but there seems to be problems here too.
I'm using form with subform. Main form header contain a combobox. I need to check the combobox is null or not before update a subform filed. If combobox is null then its back to Main form combobox from subform. The code below that I'm trying to:
Code: Private Sub AssignTo_BeforeUpdate(Cancel As Integer) If IsNull(Forms!frmDepartmentReview!cboDepartment) Then MsgBox "You must select Department first", vbInformation Forms![frmDepartmentReview]![cboDepartment].SetFocus End If End Sub
Then I'm getting 2110 run time error
Access can't move the focus to the control cboDepartment.
I have a main form which is linked through a [PackageID] field to a subform. i wast to use the same form for both shipments in and out. the subform has a list of serial numbers add for each [package id].
On the main form i have addresses ect and then a combo box onthe [PackageID] field which brings up all the serial numbers that came in, in that package.
This is perfect for sending a large container back out unopened, however there are times when the database will need to 'pick and choose' serial no.s from several packages. To do this i made the [SerialNo] field on the subform a combo box - looking up all the serial no.s in stock - however when a serial no is selected it doesn't update the other 15 fields in the subform.
Any sugestions? Got a feeling thats its quite an easy thing to do but its beaten me!
platform : access (adp) / sql server Problem : form filter not executing in subforms
When I goto one of my subforms I can activate the form filter. When executing the form filter no records show up, it just keeps showing my criteria. When disactivating the form filter I receive an error message telling that my view must be misspelled (it's about spaces). My view is called Vw_people , as a record source it works fine so it can't be misspelled.
Is the problem the adp connection or the subform? I don't know
Ive got my combos working fine now (thanks to all you kind folk on this forum!) but now that I have opened the main form (in which the combo box form is nested), once I have selected an item in the first one, and then click on the 2nd combo, a parameter box comes up saying "Forms!Training Record!Course_title_combo" and wants a value.
I cant see why this doesnt work when the form is nested, any ideas?
Every time i try to get info from a sub form or its table ,Things never sem to work.Is there something special you have to do for eg maybe going via the main form?I am trying to use dsum as an alternative to multiplying info in the sub form.This is the code
I have an orders subform displaying the line items in an order.
I have two combo boxes in the subform that allow the user to select 'Product catagory' and 'Product'. To enter a product the user must first selct a product catagory which filters the products available for selection. If the exact product is not listed then on option to 'Add new item' must be offered
The problem: At the moment the combo boxes show the same product catagory on every line of the order, even though each line is different and the second combo box is empty
How do I: 1. make the combo box only display the entry for the line it is on
2. force it to filter the available entries for the second combo box
3. offer an option in the second combo to 'add new item' (if the users selects this then Access should open the products entry form and pass the vale of 'Product catagory' from that line as a parameter to preset the form.
other info: The data for the subform is generated by a query on 3 seperate tables all linked by relationships. (tblProductCatagory, tblProducts, tblOrders)
I have an IIF function specified on a continuous sub-form as below - basically it checks to see if the value of two text boxes is equal, and if they are it displays 'And', if not it displays the value of the column EntitlementName. I'm trying to work around grouping not working in continuous forms.
When I view the form directly it works no problems but when I view the form as a sub-form instead of showing the correct output it shows #Name? Both the text boxes I refer to have the correct values in them.
I have a subform that has the Expense Code from the Expense Codes Table and I want to look up the Description (yes I know its not correctly spelled in the formula but it is in the table)
Im v new to VBA and been having trouble getting the following code to loop through the records in my subform:
Private Sub cmdComplete_Call_Click() Dim rs As dao.Recordset Set rs = Me.fsub_Call_Off_Quantities.Form.RecordsetClone rs.MoveFirst
[code]....
It only seems to update the first records txtQuantity_Called_Off value. I have tried all the 'looping' code variations i can find and they all seem to only update the first .
I have a navigation form which has two subforms on it (ie 2 tabs linking to different forms). I have got aq filter working for one of the forms but not on the other. This is using
If IsNull(Me.txtoperationscontract) Then MsgBox "Please type a contract number into the textbox!", vbInformation + vbOKOnly, "Incorrect Details" Else Me.OperationsSubform.Form.Filter = "[Contract]='" & Me.txtoperationscontract.Value & "' " Me.OperationsSubform.Form.FilterOn = True End If
The problem is that it does not work on subform B because the Contract field does not exist.
I have a form that uses a listbox. I can select multiple items and then update a subform. When I press a button with VBA and use the filter property on the subform for the first time, nothing happens. When I press the button a second time, it does - and it works thereafter with different selections. It only happens that first time, after loading the form and pressing the button for the first time.
I have tested that the list items are accessible via the vba variables and stepping through my code and the problem starts with the filter properties.
is not switched on first time (I have tried a requery and refresh statement after this). When I step through the code the first time, the FilterOn property remains false. A second button press and it is fine.
I have a form with two subforms. One subform is a datasheet that pulls data from a temp table. During the other subforms Form_Current, the temp table is emptied (DoCmd.RunSQL "Delete from tblAddRefs"), reloaded with data relevent to the current record, and requeried (Forms("frmEDFP").Controls("tblAddRefs subform").Requery). This works like I want it to...
With the exception of the initial load of the main form. The subform based on a table shows (#Deleted) instead of data. if I step through the code, I can see that the temp table is emptied and repopulated by the time I try to requery the subform. This is still happening during the Form_Current of the other subform, which is successfully running on main form load.
If I requery (Forms("frmEDFP").Controls("tblAddRefs subform").Requery) using a button on the main form once it is loaded, the #deleted data is correctly is replaced by regular data, so it's like the requery in the Form_Current event isn't doing anything during load.
I have a cascading combo box working fabulously in a form. However when I embed that form into another form, the cascading combo boxes quit working. After doing some searching around on the web I think my issue is either in the query that the dependent combo box references and/or in the "after update event procedure" but I just can't seem to figure out the exact changes to make to my database. Details:
Tables with data for combo boxes:LOOKUP TABLE - Veg Species - Species Type, LOOKUP TABLE - Veg Species - Species Name. Related together based on common field: SpeciesType
[code]...
When the form with the combo boxes is embedded as above, I can select the species type from the dropdown but when I try to select the species common name value I am asked to
"enter parameter value - Forms!SUBFORM2a - Enter Specific Veg Info!cmbSpecies_Type".
I have a subform that is in Datasheet view. If I open this subform on it's own, the Date Picker works for the Date field. However, if I open the main form with the subform on it, the date picker doesn't work? Nothing happens when I select a date on the calender.
I have two command buttons in a subform "sbfScoutRegDetails", one that launches a report and the other attaches the report pdf to an email, associated with the record ID when clicked.
Both of these buttons work fine when just the subform itself is open, but when viewing it in its main form, I get a window saying 'enter parameter value' for "Forms!sbfScoutRegDetails!ID" (this is the WHERE condition in the macro).The report then opens with all the record information blank.The full WHERE condition
Code:
[ID]=[Forms]![sbfScoutRegDetails]![ID]
Not sure if it's because of using a continuous form as a subform? I need the user to be able to view/print or email a contract to each group/contact that signs up.
How can I set the focus to the first control in a form, without referencing the control name?
Ex. Normally I do:
Me.ControlName.SetFcous
Now I have a code which adds a new record, which is used on several forms, therefore the control name is not always the same, so I would like the focus to move to the first field on the tab order. Any ideas please?
I am just learning VB, much less Access, even more so how to just understand all the code. My conundrum: In my form, I have 4 sets of tabs (not pages - each tab contains +/- 8 pages). Each tab is controlled visibly by 1 of 4 text boxes within the form, not positioned within the tabs. When each respective control is clicked, it is bolded (i.e. fontbold = true) and its repective tab set becomes visible (i.e. true), "hiding" the other 3 tab sets (i.e. visible = false). This is dependent on changing setfocus to the control (according to my error messages which say I cannot move the setfocus to the control or I can't hide a control that has the focus). After I try to setfocus to Tab2 and click the control for Tab2, it says the same thing, that I can't hide a control that has the focus. I've tried setting focus to the tabs, to the labels that control the tabs, to labels within the tabs, and to text within the tabs - all to no avail. If anyone has a suggestion, I would be most appreciative. Cheers.
If a user enters too many characters into a field I want to display a message and then keep the user in that text box until less characters are entered.This is the codePrivate Sub txtTitle_LostFocus() txtTitle.Value = LTrim(txtTitle.Value) If Len(txtTitle.Value) > 50 Then MsgBox "Title is too long. Can not be more than 50 characters", vbOKOnly, "Title Too Long" txtTitle.SetFocus End IfEnd SubThe message appears but focus moves to the next text box almost as if the setfocus command has been ignored.Anyone got any ideas as to why??Thanks
I have litle problem regarding SetFocus.I have 2 Forms - form1 and form 2.On form 1 I have txtSomething and when I open form2 I can not SetFocus on txtSomething.I have tried with
I'm having an issue with part of my code. I have a logout function which closes one form and then reopens the login form. It does this fine, but I can't type in any of the text boxes on the login form unless I close it out and reopen it manually. Here's the code:
vb Code: Original - vb Code Private Sub cmdLogout_Click()On Error GoTo Err_cmdLogout_ClickDoCmd.OpenForm "userlogin", acNormal, , , acFormReadOnly, acWindowNormalForms!userlogin!txtuserid.SetFocusDoCmd.Close acForm, "Control Panel", acSaveNoForms!userlogin!txtuserid.SetFocusExit_cmdLogout_Click:Exit SubErr_cmdLogout_Click: MsgBox Err.Description Resume Exit_cmdLogout_ClickEnd Sub Private Sub cmdLogout_Click()On Error GoTo Err_cmdLogout_ClickDoCmd.OpenForm "userlogin", acNormal, , , acFormReadOnly, acWindowNormalForms!userlogin!txtuserid.SetFocusDoCmd.Close acForm, "Control Panel", acSaveNoForms!userlogin!txtuserid.SetFocusExit_cmdLogout_Click:Exit SubErr_cmdLogout_Click: MsgBox Err.Description Resume Exit_cmdLogout_ClickEnd Sub
I've tried setting focus as shown above, but still no luck. Any ideas?