Forms :: How To Tell If A List Box Has Focus

Aug 1, 2015

i have a button that allows you to "edit" the show that is selected. You can double click the show name from the list box, and it opens that show in viewing mode, but you cant edit it. You can click the edit show button in the form that you view the show with, but I want to be able to edit that show from the main form with the list box. But, the problem im having, is if someone clicks the "Edit show" button without have a show selected, they get a error.

If lstShows has focus Then
DoCmd.OpenForm "frmEventsEdit", , , "EventID = " & Me.lstShows

Else
'do nothing, since having no code here, it does nothing

End If
End Sub

That is what I want, but I cant get access to open that show up if its selected.I need to be able to tell if it has focus on it, and to open that selected show up.

View Replies


ADVERTISEMENT

List Box Focus

Nov 8, 2005

Hi

I have a list box setup with all the dates from 01/10/05 to 31/12/08.

I want to always start the list box at the current date while still allow the functionality to backdate if required.

I have used the undernoted code to set the row correctly but I cannot figure how to get the box to scroll down to the correctly selected row.

Dim i As Long

i = DLookup("ID", "tblIMDates", "cdate([Date])=date()") - 1

Me.lstDates.Selected(i) = True

Any ideas?

JC

View 5 Replies View Related

Removing Focus From A List Box

May 8, 2006

Hi All,

I have a form with 3 list boxes. The user selects an option from each list box and depending on their selection a set of data appears in a subform. If the user then goes back to the first list box and makes a new selection, the next two list boxes still have their records highlighted from the last set of selections. What is the line of code that would remove the focus from the second and third list boxes if a value in the first list box was changed?

Any help would be greatly appreciated.

Best Regards,

Aaron

View 2 Replies View Related

Possible To Scroll Through List Box Without Setting Focus?

Mar 1, 2014

it is possible to be able to scroll through a List Box with just a mouse over? Or, do you need to set focus on the ListBox before being able to scroll?

View 8 Replies View Related

Forms :: Set Focus To Sub Form?

Sep 14, 2014

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

View 2 Replies View Related

Forms :: Set Focus To A Subform

Mar 20, 2014

If i open a form with a sub form on can i open it so that the focus go directly to a control on a sub form.I have tried to do it with a macro on the on open event to go to control but it comes up that the control don't exists on the sub form.i am using access 2010.

View 6 Replies View Related

Forms :: Cannot Set Focus To The Control

Sep 1, 2013

This code stopped working without explanation after the longest time. I can't seem to fix it.

Code:
Private Sub Send_Letter_AfterUpdate()
Call Set_CallDateUserId
End Sub
Private Sub Set_CallDateUserId()
Me.txtCallDate.SetFocus

[Code] .....

View 4 Replies View Related

Forms :: How To Keep Focus On One Record

Jun 22, 2015

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

[Code] .....

View 5 Replies View Related

Moving Focus/control On Sub Forms

Feb 16, 2006

I have a parent form called "frm_job_enter"

and two sub-forms called "frm_fabricator" & "frm_engineer"

On the sub form "frm_fabricator" I have a combo box and after updating this combo box (called fabricator) I would like the cursor to jump into a field called “ApllicationsEng” on the other sub form "frm_engineer"

Any help would be appreciated thank you.

View 3 Replies View Related

Forms :: Set Focus On Subform Control?

Mar 7, 2014

I have a form with a subform on it. The subform has subforms. I need to set the focus on a control on one of the subforms. Here is what I am using.

START OF CODE
Forms!frmMain!frmMainSub.Form.frmContactLog.SetFoc us
Forms!frmMain!frmMainSub.Form.frmContactLog.Contac tMethod.SetFocus
END OF CODE

I use Code 1 to get to the third level. Code 1 works.

Code 1
Forms!frmMain!frmMainSub.Form.frmContactLog.SetFoc us

When I add the second line, Code 2, it doesn't work. I get the message "Run-time error 438: Object doesn't support this property or method."

Code 2
Forms!frmMain!frmMainSub.Form.frmContactLog.Contac tMethod.SetFocus

View 2 Replies View Related

Forms :: How To Set Focus On Specific Text Box

Nov 11, 2013

I have a continuous form with a combobox and a text box. In the after_update event of the combobox I want to setfocus on the text box - of the specific record that I'm on. I tried using Me.CurrentRecord but that returns me to a completely different record than the one I was on. How can I setfocus to the text box of the record I am on?

View 12 Replies View Related

Forms :: On Got Focus Move To New Record

Jun 23, 2013

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.

View 10 Replies View Related

Forms :: Set Focus And Requery Data

Mar 17, 2013

I have a Dynamic Search form, which I use to search for client, on the double click it takes me to the client, at which point I have the Forms Visible set to False.

When I click on a button to open that Form, the Visible turns back to True, however it shows my last search results, how do I clear it so that when I call it back up it is ready to search again, and my focus is set to the SearchFor box.

View 3 Replies View Related

Forms :: Navigation In Textbox - Set Focus?

Dec 8, 2014

In a form, I go to a textbox with setfocus. The whole text is selected then. But how can I place the cursor after the existing text, so that I can begin writing immediately?

View 3 Replies View Related

Forms :: Fields Jumping When Have Focus

Sep 1, 2013

When the client clicks in a text-Box or Combo-box in a sub-form, the field seems to jump to the side. in this image it jumps to the left, but jumps to the right to..., it is quite irritating, especially attempting to open a combo-box list, and see the button jumping aside.We renewed the file many times, so I don't think it is corrupted, but go know..the file can be accessed via network or terminal server, the pic is from terminal, but happens via network too.

View 1 Replies View Related

Forms :: Set Focus To Last Line Of Subform

Jan 21, 2015

I have a single main form with a datasheet subform. When I scroll through the records shon in the main form, each has a different set of child records shown in the subform.

I want the focus to be on the last record of the subform each time.

On the main form, I have a button and this code

Code:
Private Sub cmdLast_Click()
Me.frmRevisionsSub.Requery
Me.frmRevisionsSub.SetFocus
Me.frmRevisionsSub.Form.txtRevTag.SetFocus
DoCmd.GoToRecord , , acLast
End Sub

which works perfectly, when I click the button.

If I call this code from main form's OnCurrent, focus remains on the first line of the subform instead of going to the the last. I have an inkling that it has to do with when the requery of the subform takes place, when I scroll through the records on the main form.

View 1 Replies View Related

General :: Setting Focus On Forms

Jun 26, 2015

I am having trouble setting the focus on my forms... I have a parent form with two labels that are coded like this.

Private Sub Advisory Messages_Click()
Me![ Advisory Messages].Visible = _
Not Me![Advisory Messages].Visible
End Sub

[code]...

I have the visible property set to no on the subform allowing the user to toggle the visibility when the label is clicked. The problem though is when I click inside the subform to use the scroll bar to view records, it transfers the focus to the subform making it almost impossible to close by clicking the label again because the label is on the parent form. I found the "me.parent.setfocus" command and a few other set focus commands but I don't know what I should be applying the command to in order to make it work.

View 3 Replies View Related

Forms :: Subform - Set Focus To Other Record

Jan 2, 2014

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.

View 5 Replies View Related

Forms :: Can't Disable A Control While It Has Focus

Jul 18, 2015

I have a form that allows me to update entries in a table. When I select the line I need to update and hit the "edit" button I get a run time error '2164' You cant disable a control while it has the focus. when I debug the line in the code that is highlighted yellow is
Me.cmdEdit.Enabled = False.

I developed the database in access 2013, and now I am forced to run the database on a computer that has Access 2003. I have changed the database base to access 2000-2003.

View 5 Replies View Related

Forms :: Can't Hide Control That Has Focus

Jan 18, 2015

I have a toggle control on a form which depending on selection uses a loop and instr to make 'not visible' a set of controls on a subform.(forms! Mainform !subform.form)I get error 2165 but if I test immediatley before the make not visible process it returns the toggle frame as being the active control.

View 3 Replies View Related

Forms :: Tabbing And Setting Focus On A Button?

Oct 21, 2013

I have a form with a tab control on it. The input for respective fields are placed inside the tab control, and I have the "Confirm" button placed outside, on the main form. Now I wanted to be able to navigate my focus from a control from inside to tab control, out to the Confirm button on the form, to allow smooth flowing data entry.

However, it seems like Access separates the tab indexes for the controls in the tab control and outside on the main form, so setting tab index does not work. I tried using the code ON LOST FOCUS and SET FOCUS;

Private Sub txtPurchaseNote_LostFocus()
Forms![frm Imported]![cmdConfirmPurchase].SetFocus
End Sub

But then a dialog box appears:

Run-time error '2110'
Microsoft access can't move focus to the control cmdConfirmPurchase

(cmdConfirmPurchase is a button control)

View 2 Replies View Related

Forms :: Set Focus - Sending Cursor To First Field

Dec 31, 2014

I have a form (Home_Interview_Form) with several subforms (AirFresheners, Pesticides1 etc), and I would like the cursor to move from the last field in one subform to the first field in the next subform on keydown. I have written the following code, but instead of sending the cursor to the first field (PestSpray) it is going to the next field (PestSprayCom) in the subform for some reason. I am using Access 2013.

Private Sub Fresh2React_KeyDown(KeyCode As Integer, Shift As Integer)
Forms!Home_Interview_Form!Pesticides1.SetFocus
Forms!Home_Interview_Form!Pesticides1.Form!PestSpr ay.SetFocus
End Sub

View 5 Replies View Related

Forms :: Set Focus To Text Box Once Button Is Clicked

May 28, 2014

What do I need to put into a macro attached to a command button to set the focus to a text box once the button is clicked?

View 1 Replies View Related

Forms :: Combo Box Not Getting Focus When Opening Via Navigation Bar

Aug 13, 2014

I have a combo box combo51.

If I open the form directly from the left pane (all access objects)
forms engineering entry
the form opens and combo51 has focus (the cursor is in it)

If I open it from the Engineering tab on the navigation bar the Engineering Entry is the default left hand form and opens, but no focus as in the screen dump.

If I go to the code on Engineering Entry, On Load, Combo51.SetFocus This doesn't seem to work as I would expect.

How can I get this combo box to get focus when opening this form via the navigation bar.

View 14 Replies View Related

Forms :: Field Focus In Modal Form

Dec 29, 2014

How do you set the focus on the first field in a modal form when it opens?

View 3 Replies View Related

Forms :: Setting Form Focus Properly?

Jul 10, 2014

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.

View 14 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved