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.
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.
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?
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! :)
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... ;/
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.
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 :
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.
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.
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.
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?
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 )
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.
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 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.
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?
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?
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
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:
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
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?