Does anyone know how I can add a record to a subform that is in data sheet view with out giving the subform focus? I have tried the docmd.gotorecord but I keep getting an error that the form is not open. If i set focus to the subform and then use the docmd.gotorecord it works fine but I do not want to set focus to the sub form
I have a customer provide his or her SSN. If the SSN matches a record in a table the form opens specifically on that record (no problem). If the SSN doesn't match a record, the form adds a new record (again, no problem).
The issue I'm having is with the new record. The customer is able to scroll through other records (page up, page down), which is a no-no. I need the form to be locked on the new record. I've posted my code below.
Private Sub Command543_Click() On Error GoTo Err_Command543_Click Dim strCriteria As String Dim rst As DAO.Recordset Set rst = Me.RecordsetClone
I have a sub form on a tabbed control. In the subform I have some calculated controls and I make them recalc when ever data in other fields change bu entering a recalc cmd in the update event of the required fields. That is all fine but the problem is that the forms focus moves to the first record and I need it to stay on the active record.
I have tried requery, recalc and refresh methods and they all do the same thing.
All I need to do is up date the calculated controls each time a field is updated and stay on the same form but it's eluding me.
I have a subform that I use to scan in products using a barcode reader, when the item scans it moves to the quantity (Qty) field where I have this code:
Code: Private Sub Qty_GotFocus() Qty.Value = 1 DoCmd.GoToRecord , , acNewRec txtOrderNo.SetFocus End Sub
I am simply trying to set the Qty value to 1 and move onto the next record ready to scan another product in.
I have a form with a subform which is sized to show several records at the same time. If Record A has the focus, and I click anywhere in Record B, then Record B gets the focus, as expected. ... Except if I click on an Image field in Record B, when the focus stays on Record A.
How I can force it to set the focus to the other record ? I don't think this can be done with Events handlers, as they need to have the focus set first.
On a form (default view: Single), I have a bunch of bound controls that display one record at a time from tblMain. I have a bunch of unbound controls as well (buttons).
If the user tabs through all the controls, reaches the last one (btnLast), and presses tab again, the focus is set to the first control (btnFirst) and the bound controls change to display the next record. I just want the focus to be set to the first control without the displayed record being changed.So I set up an "If" statement in Private Sub btnFirst_GotFocus()
Code:
If Screen.PreviousControl.Name = "btnLast" Then [code to change record back to previous record] End If
But btnFirst gets the focus when the form opens, so Screen.PreviousControl spits out an error.I've accommodated this like so:
Code:
On Error GoTo ErrorHandler If Screen.PreviousControl.Name = "btnLast" Then [code to change record back to previous record] End If Exit Sub ErrorHandler: Exit Sub
When I right click a row on the data sheet side of a split form an select "New Record" I want the curser to go to the first field on the single record side. I've placed this in the OnCurrent but it did no good.
Code:
If Me.NewRecord Then Me!Descrfiption.SetFocus. End If
Any way to set the focus to the single form Side of a split form?
Hi, this is frustrating, and a little complicated, so I'll try and explain it as best I can..
I have a form with two sub forms.
The main form "fmMain" contains a list of species. the subform which is causeing me the problems lists loci specific to each species. The user can search by a species or locus and resrict the list accordingly.
Now, here is the problem. The form is too large for my screen, so I have some scroll bars on fmMain. However, whenever the user performs some kind of search the focus shifts to the subform (I guess), causing the screen to scroll to the middle. From here you can't see the species info, and after each navigation the user has to scroll back up again. It's frustrating having to continually scroll around the screen.
Is there anything that can be done to stop the focus shifting around? I'd rather that when the user performed some action the screen just simply didn't move.
Cheers - sorry for the monster post! (hope it all makes sense)
My main form has four command buttons that when clicked will make visible one of four subforms.
I can switch freely about the subforms by clicking on each of the buttons. However, when I place the cursor in a subform(and thus give it Focus), and then attempt to select another button to open another subform, I get the dreaded "can't hide a control that has the focus" error message.
What type of code should I use and where exactly should I be putting it?
I've tried setting focus to another subform in the OnClick event of my buttons, but that doesn't seem to be working.
On a main form I have 2 sub forms. On the main form I have a command button that asks how many guests in a booking and depending on the response populates the subform with Guest Names. However it will only do this if I click on the subform and then click the command button.
I want to include some code that sits behind the command button on the main form that will duplicate the otherwise manual selecting of the sub form. And I am thinking this is a SetFocus procedure.
I have tried this code; [Forms]![Booking].[SubForm1].SetFocus where Booking is the name of the form. I do not know whether the Subform is #1
I have two forms that have a unique field (SSN).As I'm working in one form, I want to be able to pull up the other form (which isn't a problem). On the second form pulled up, I want the record to match the first form (SSN) - this is the problem.
I believe SetFocus is what I need to use but I don't know how to capture the SSN from the first form to use as the focus for the second form.
I have a form for entering data and to aid people inputting data into a text box I would like a pop up form to appear to enable them to refresh their memories as it were with some information. I was going to use the got focus event of the text box to open the popup but how do i then pass the focus back to the main form and text box without triggering the event again
on the flip side I would like to use the lost focus event to close the sub form as well.
I have a Main Form with a tab control. On each of the six tabs is a SubForm that takes up the entire tab. So basically I have a tabbed interface for my forms, just with a bit more control over the layout than if I just opened the forms separately in the Access window.
Anyway, on one of those subforms is a button. When you click it, it opens a separate form in a pop-up window, which is used to find a specific record. Once that record is found, you can click another button, and the idea is that this pop-up window closes, and you return to the underlying form, which jumps to the record you selected.
So far so good. Now, if I am working on my program in Access, and I open that subform's source form separately in its own tab, click the icon to open the record finding form, find a record, and then click the button to load that record, the following code runs, and it runs flawlessly - closing the pop-up window, and passing the information back to the main form which displays the proper record:
Quote:
Private Sub ViewRecord_Click() Dim RecordID As Integer RecordID = Me.ID DoCmd.OpenForm "CDLExam", , , "ID = " & RecordID DoCmd.Close acForm, "CDLExamCONT", acSaveNo End Sub
Where my program falls apart is that, in actual use, this form is not open on its own. It's open as a subform on one tab of a tab control on a Main Form. So the third line of code falls apart. Access thinks I want to open CDLExam separately, but it can't because it's already open in the subform, so instead I just end up back at the main window like I want, but the form fails to move to the proper record. Basically, line 3 just doesn't do anything.
How can I make this work? I tried replacing "CDLExam" with the name of the main window, but then it tries to move to the record in the main window, which throws an error as the main window doesn't even have a record source attached to it.
how to refer to the SUBFORM which has CDLExam open, and tell THAT to move to the proper record.
I'm sure there is a simple solution - but everything I have tried hasn't worked. I have a command button on my main form that opens up a popup form. On the popup form the user makes various selections and clicks on another command button(on the popup form). That button is linked to a macro - that runs several queries.
The problem I am having is when the macro starts to run - the main form is maximized again (so now it doesn't take up the full screen - just a part of the screen) and some of the queries start flashing in front of the form.
I know how to maximize the form once the popup form closes - that's not a problem. I just cant figure out how to keep the focus on the main form and in front of all the queries as they are running.
I have added an OLE WordPad object to a form. However, when I use the form, I cannot select/give the object focus to activate it. Even if I right click the object, it give me the correct popup menu. :confused:
I am using this object as I am having troubles with Memo fields. I use a form to update records, one field of which must be greater than 255 characters long. When I press my update button (it just runs some code to turn off warnings, run two simple update queries and the turn the warnings back on) the update process seems to complete. However, if I go to the table/refresh the form contents, only the first 512 characters are displayed and the last few are strange system characters.:confused: This occurs no matter what I do. I was tole that copy/paste operations can mess memo fields up, but I tested this by using a fresh field and typing everything in. Hence I am now trying the OLE object to get around this problem. :confused:
On my data entry form I have a tab control with three pages
At the bottom of the first page I have a sub form with 3 fields
Currently, when tabbing, the focus runs through the fields as per the tab order
BUT
Once it gets to the subform (datasheet view) it jumps into the first field of the first record rather than the first 'empty cell' thereby starting a new record in the datasheet.
Once the three fields in the datasheet are completed the focus tabs back to the top of the first page of the form rather than onto the next page of the form
How to correctly reference controls using VBA so I could SetFocus where I want?
The Main form is called frm_Admissions
It has three pages called Patient, Treatment & Service Providers
Patient has a subform called sub_Cluster (which may or may not hold Cluster Information)
I would like the tab order to jump from the last textbox on the form into the first field of a new record in the datasheet (rather than the first field of any existing records)
Once it has finished in the datasheet I need to tab to the first field/textbox in the Treatment's page of the form rather than back to the first field/textbox in the Patient's page.