SetFocus Problem With Repeated Item

Aug 17, 2006

I have a form that simply lists the items:
DEPARTMENT_NBR and DEPARTMENT_NAME

In the table: DEPARTMENT_TBL

When I edit the field DEPARTMENT_NBR and it is in error (must be between 01 and 99) I want to put out a message in a MSGBOX and SetFocus back on the DEPARTMENT_NBR.

I coded the MSGBOX with vbokonly and then DEPARTMENT_NBR.SetFocus, but after the message displays and enter is hit for the ok the cursor jumps to the DEPARTMENT_NAME on the current line. Is there a way to get the SetFocus to work properly on repeating items like this? I can never seem to get them to perform the same as they do on non-repeating items.

Thanks for your help.

HERE'S THE EXACT CODE:
If IsNumeric(DEPARTMENT_NBR) = False Then
If DEPARTMENT_NBR <> "00" Then
MsgBox "DEPARTMENT NUMBER must between 01 and 99.", vbOKOnly
DEPARTMENT_NBR.SetFocus
GoTo DEPARTMENT_NBR_EXIT
End If
End If

Also, is there a way to look at a specific item in a list like that? IE. I want to reference the 3rd row's DEPARTMENT_NBR. Thanks.

View Replies


ADVERTISEMENT

Setfocus On Repeating Item/accessing A Specific Item

Aug 18, 2006

I have a form that simply lists the items:
DEPARTMENT_NBR and DEPARTMENT_NAME

In the table: DEPARTMENT_TBL

When I edit the field DEPARTMENT_NBR and it is in error (must be between 01 and 99) I want to put out a message in a MSGBOX and SetFocus back on the DEPARTMENT_NBR.

I coded the MSGBOX with vbokonly and then DEPARTMENT_NBR.SetFocus, but after the message displays and enter is hit for the ok the cursor jumps to the DEPARTMENT_NAME on the current line. Is there a way to get the SetFocus to work properly on repeating items like this? I can never seem to get them to perform the same as they do on non-repeating items.

Thanks for your help.

HERE'S THE EXACT CODE:
If IsNumeric(DEPARTMENT_NBR) = False Then
If DEPARTMENT_NBR <> "00" Then
MsgBox "DEPARTMENT NUMBER must between 01 and 99.", vbOKOnly
DEPARTMENT_NBR.SetFocus
GoTo DEPARTMENT_NBR_EXIT (exits the paragraph skipping other checks)
End If
End If

Also, is there a way to look at a specific item in a list like that? IE. I want to reference the 3rd row's DEPARTMENT_NBR. Thanks.

View 4 Replies View Related

Queries That Extract Repeated Item

Nov 14, 2007

I'm trying to set up a query where it returns me only the items that are repeated.

ie...I have a table that has clients that are one time clients and other that are repeated. Each client has a client number. I would like to get only the clients whose client number appears more than once. Is that possible?

View 1 Replies View Related

Counting Repeated Data

Oct 11, 2007

I have qrys that show current info and also repeated info. A request has been brought to me to now count how many times the repeated data has been repeated.

The data is updated daily, so the repeated record would need to increase in the number of it's occurances by 1 each day.

Any guidance on how to accomplish this is GREATLY appreciated! :)

View 5 Replies View Related

30 Cap Limit On Repeated Forms?

Jan 16, 2006

when i change a form so that instead of single form its multiple forms it seems to only want display 30 instead of the 62 that exist. is there a quick fix this?

if not is there a way to make it display the next 30?

as now it says "record 30 of 62" when it gets to the bottom of the form... ;/

any help is much appreaciated ta. <3

View 3 Replies View Related

Select One Record For Each Repeated Entry

Mar 6, 2006

Hello All,
In my table, I have some records that are duplicated (aside from the primary key).
How can I select only one record from each set of duplicated entries? (There may be more than 2 of each of the duplicated records, but I only need to pull one of them...doesn't matter which one.)

i.e...Like a 'Find Duplicates' query, but only returning the top 1 primary key from each duplicated set.

Thanks,
Sarge.

View 2 Replies View Related

Query Returning 3 Repeated Records Per ID?

Mar 15, 2006

I am trying to build a query which will find the costs from a set of tables where the client has costs.

The client has a cost on booking a fee, he has a hotel room cost and a room facility cost.

My query brings up what I want but each result is repeated 3 times.

I don't know why, can someone correct me please.

SELECT DISTINCT Addresses.ID, Holiday_Bookings.Initial_Cost, Room_Facilities.Cost, Rooms.BasicCostPerNight
FROM ((Room_Facilities INNER JOIN ((Hotels INNER JOIN Rooms ON Hotels.HotelID = Rooms.HotelID) INNER JOIN Stops ON Hotels.HotelID = Stops.HotelID) ON Room_Facilities.FacilityID = Rooms.FacilityID) INNER JOIN (Routes INNER JOIN WalkTypes ON Routes.RouteID = WalkTypes.RouteID) ON Stops.StopID = Routes.Arrive_In) INNER JOIN (Holiday_Bookings INNER JOIN (Groups INNER JOIN (Clients INNER JOIN Addresses ON Clients.ID = Addresses.ID) ON Groups.ID = Clients.GroupID) ON Holiday_Bookings.ID = Clients.ClientID) ON WalkTypes.Walk_TypeID = Groups.GroupID;

View 3 Replies View Related

Replacing Repeated Values From Recrods?

Mar 4, 2007

Attaching a sample mdb file. I have TABLE1, TABLE2 and QUERY1, QUERY2 in my mdb file.

I want Query1 Value 4 once in Query2. It should not be repeated again with [SBNO] values 5 time.

Value 4 in Query 2 shows with only 1st record and remaing 5 records shows 0 value instead of 4.

How is it possible.? Can anyone help me.

View 3 Replies View Related

Can I Use A Query To Show Only One Of Each Repeated Data

Nov 7, 2007

I am really new to using access and I have a massive table 16000 or more entries. What I need to do is take this example data :

VPIAddress
001:99_97_AO
001:99_96_AO
001:99_0_AI
001:986_51_CI
001:986_50_CI
001:985_51_CI
001:985_50_CI
001:984_50_CI
001:983_51_CI
001:983_50_CI

(This is just a tiny fragment of the total data)

The 001: to the first '_' is the important bit this is defining a "Router" what I need to do is total up how many '001:*_' there are, not including duplicate numbers.

Firstly if I understood this (http://www.access-programmers.co.uk/forums/showthread.php?t=92001) post correctly I need to have all the VPIAddress the same. If this is correct is there a way to get access to delete the data after the first '_' ? (I would of posted in this tread but i didnt think that would be right, if im wrong mods move the post :) )

Secondly will the info in that post help me to reduce the data into this :

VPIAddress
001:99_
001:986_
001:985_
001:984_
001:983_

So that I can then see how many Physical "routers" there are

If any one can help me and tell me that my idea will work then tell me how to do it id be extremely happy!

Even if any one says that wont work and gives me the correct way to do it and does a virtual "Clip around the Head" and call me a Daft Bugga I would still be happy because I wouldn't have to trawl through the entire 16000+ entries deleting and modifying.

View 4 Replies View Related

A Set Of Two Conbo Boxes Repeated In A Form

Aug 4, 2005

I have a pair of combo boxes which are n a frm and work fine.
The code is:

Private Sub cboSubjectSelector_AfterUpdate()
Me!cboOneBookSelector.Requery
Me!cboOneBookSelector.SetFocus
End Sub
Private Sub Form_Current()
Me!cboOneBookSelector.Requery
End Sub

I want the combo boxes to be repeated five more times so that the same options are given within the same form. Every time inset a copy of the same combo box get the folowing error message:

'Microsft Access can't find the macro 'requery''
I am ot sure what I need to do nrder t remove the error message. I did not create a macro called 'requery' tis part of the code above.
I have alos tried to recopy the code above and then retnamed the cbo in the form adn then modified then copied and modified the code to see if that helps - it doesn't. Any ideas - please help.

View 1 Replies View Related

Reports :: Counting Repeated Dates As 1

Jul 14, 2014

I have an activity report which has multiple entries for the same date by club members. I have managed to build the database:

2 Tables
2 Queries
2 Forms
1 Report

Which list attendance's and activities by Member and Date and Prints each one starting on a fresh page..What I wish to do is count each Club Members total days attendance. I have tried using the Totals button but I don't know enough about expressions to get it to count multiple dates as 1.

Everywhere I have looked can tell me how to count between dates, around dates, workdays in a year etc. etc. etc. but none give me multiple dates the same counted as 1.

View 14 Replies View Related

Repeated Queries And Updated Data

Sep 13, 2013

I am running repeated calculation queries of different data, but its is not working to well. I have one query listing the total number of hats made from wool. I then have a second query of that lists the total number of hats made from wool and are black. I have third query that calculates the percentage. I have many different hats of many different colors, and i am doing the same three queries over and over. However, the calculated field for percentages does not update. E.G. I have 100 wool hats, 10 wool,black hats, 10%. The next round: i have 100 wool hats, 5 wool green hats, its will still show me 10%, as its is still calculating based on the previous data. how can i go about this most efficiently and why is not updating?

View 1 Replies View Related

Combo Box List: Repeated Names Problem

Dec 11, 2004

my search form has a combo box with "make"names. i can add new makes via a other form. so the combo box needs te run via a query so that it can list new makes (so that i can also search them). but, since some makes repeat them selves in the table, sometimes up to 15 times (see atachment 1), the combo box will show 15 times the same make. i just need it to show the make 1 time, all of the makes just 1 time. only way i can do that is to type them my self (see atachment 2). but then new makes that are added later wont be shown in the list.

so: i want that the make is only shown once in the list, and that the list is updated with new makes that are added later. how do i do that?

note: a "make" E.G = Philips, Apple, LG, Microsoft, creative etc (just for the lesser skilled english readers like me )

all help is welcome

View 2 Replies View Related

Tables :: How To Break Down Repeated (Quantity Ordered) 1 Through 5

Apr 17, 2013

Right now I have a flat database with too many unnormalized fields. I am trying to figure out how to break down the repeated "QuantityOrdered" 1 through 5. "QuantityReceived" 1 through 5.

"RequestedItems" 1 through 5 and "Price" per unit 1 through 5. I'm not sure if they go into the same tables, if they are each listed 5 times and if in different tables how many instances 1 or 5 to show each as seperate and how to create a relationship between them.

View 4 Replies View Related

SetFocus

Apr 11, 2005

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?

View 2 Replies View Related

Can I Setfocus To Tab In VB?

Aug 25, 2004

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.

View 3 Replies View Related

Setfocus Problem

Apr 13, 2006

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

View 6 Replies View Related

How Do I SetFocus To A New Record?

Apr 26, 2005

My form is in tabular form so it is just a running list. How do I SetFocus to a new record when the form is opened?

View 4 Replies View Related

SetFocus With Subform

Jul 13, 2005

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.

Any suggestions would be appreciated.
Thanks

View 2 Replies View Related

SetFocus To TxtSomething

Jan 19, 2006

Hello,

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

Forms!Form1!txtSomething.SetFocus

but something wrong,can someone help,

thanks

View 5 Replies View Related

SetFocus On Close

Feb 15, 2006

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?

Thanks,

JMH

View 2 Replies View Related

General :: Rewriting Repeated Blocks Of Code For Combo Boxes

May 10, 2013

I just recently started programming in MS Access. I have some forms with lots of combo boxes. I do not want users to type anything in the boxes, but to only select stuff that is contained in the drop down menus.I found this useful code and I am using it in my combo boxes on the key down event to do what I want.

Private Sub cmb_a_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode <> vbKeyTab And KeyCode <> vbKeyReturn Then KeyCode = 0
End Sub

Private Sub cmb_b_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode <> vbKeyTab And KeyCode <> vbKeyReturn Then KeyCode = 0
End Sub

Private Sub cmb_c_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode <> vbKeyTab And KeyCode <> vbKeyReturn Then KeyCode = 0
End Sub

The issue is because I have so many combo boxes, is there a better way to rewrite the code so I don't have to repeat the same code in 20 places?

View 5 Replies View Related

Handling Repeated / Mirror Records In Query As A Result Of One To Many Relationship

May 5, 2015

I have built a contacts manager based on an Outlook export (I know I can link the two programs, but I wanted to customize the contacts a bit further). I built the database in a way that phone numbers, addresses, etc. allow for multiple entries for each person under the same column using a foreign key. The only difference is a field called "Type" which designates the entry for Home, Work, etc. The issue I ran into is when I queried the data I get multiple entries for the same record. As you are all likely aware, Access repeats the data in a query for each different case. For example if Bob Jones has a personal and work phone number, Access will show the results in a query like this:

1. Bob Jones 555-555-5555 Personal
1. Bob Jones 555-222-2222 Work
2. Jerry Smith 555-111-1111 Personal

If I kept the data in Access it wouldn't necessarily be an issue. However, I want to be able to export the data in an excel file. How do I get Excel to return the data so it looks like this:

1. Bob Jones 555-555-5555 Personal 555-222-2222 Work
2. Jerry Smith 555-111-1111 Personal

View 3 Replies View Related

Setfocus Going To A New Record In Subform

Feb 23, 2006

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:

Forms!frmDrawingsRegister!frmDrawingRevisions.SetF ocus
Forms!frmDrawingsRegister!frmDrawingRevisions!txtL atestIssueDate.SetFocus

frmDrawingsRegister = main form
frmDrawingRevisions = subform

I have set the Cycle property of the subform to Current Record.

Why would this be happening?

View 1 Replies View Related

SetFocus On A Selected FieldName

Apr 24, 2005

I have a form with numerous fields and would like to be able to move the focus to a selected field by typing the field name into a control box. How can I do this? TIA

View 4 Replies View Related

Setfocus In Subform Not Working

May 5, 2005

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?

Example:

[subfrm1].Form![Field2].SetFocus
[subfrm1].Form![Field1].Enabled = False

This fails if the focus was in Field1 at the time of executing the code.

Any ideas?

View 3 Replies View Related







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