I have 2 comboboxes (cboTeacher1 and cboTeacher2) and I do not want them to contain the same value. If the same value is chosen, I want a messagebox to show the error and keep the focus in the offending combobox.
I wrote the code below for cboTeacher1 and it functions in the case that your are making a selection in cboTeacher1; however, if you click ok on the msgbox and then press tab, the mesage box is not redisplayed and the focus is switched from cboTeacher1.
I tried placing the same code also in the cboTeacher_Exit event and when tabbing out of cboTeacher1, the msgbox is displayed, but the focus will not stay in cboTeacher1, it shifts to cboTeacher2.
How do I keep the focus locked in cboTeacher1 until both cboTeacher1 and cboTeacher2 contain different values.
Private Sub cboTeacher1_BeforeUpdate(Cancel As Integer)
If cboTeacher1.Column(1) = Me.cboTeacher2.Column(1) Then
' Both Primary and Secondary Teachers are the same
'Determine if either Teacher cbo contains a null value
If IsNull(cboTeacher1) = False Or IsNull(cboTeacher2) = False Then
' Alert the User of the discrepancy
MsgBox "You can not have the same teacher's name in bowth Primary and Secondary Teacher"
Me.SetFocus
End If
End If
End Sub
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 am trying to get the value of a combobox after selecting an "OK" button but get "You can't reference a property or method for a control unless the control has the focus." Most would probably say use .Value but when I press "OK" I am prompted for a value, or as in another case get Null.I tried setting the focus prior to the violating line of code, but no go.
Example:
Code: Private Sub viewByRegionOKButton_Click() DoCmd.OpenReport "byRegionReport", acViewPreview, , "RegionName = '" & regionComboBox.Text & "'" End Sub
When I open a Form, it appears in the proper size. Then, I go and open a Report, which is a DoCmd.Maximum on open. This works well. The report is enlarged. Now, when I go to open a form, the size of the form is max. I tried Borderline dialog, fit window, DoCmd.MoveSize, and a couple of other things, but I cannot get those forms to keep their original size-they blow up! How can this be accomplished?
When I open a Form, it appears in the proper size. Then, I go and open a Report, which is a DoCmd.Maximum on open. This works well. The report is enlarged. Now, when I go to open a form, the size of the form is max. I tried Borderline dialog, fit window, DoCmd.MoveSize, and a couple of other things, but I cannot get those forms to keep their original size-they blow up! How can this be accomplished?
Hi guys, I made an application consisting of an Access frontend with an MySQL db as backend. I have to deploy it through different offices in different cities and I would like to know how can I maintain the same .mdw (security file) for all the PCs. Some users will move constanly between offices and I need an easy way to maintaint the .mdw coherent between them, and I don't find how to do it. Hanging the .mdw on the web would be perfect (perhaps not for security, but I'm much more concerned about usability), but Access doesn't seem to allow it easily. Does anyone know how can I solve this problem? thx
As you can see in the year 2010 items 2 and 3 go down from qty 2 to 1. What I am trying to do is to keep track of everything that was ever shipped to the customer. So with that in mind the above table is showing that Qty-2 was ordered in 2009 and Qty-1 was ordered in 2010. I want to add these as I go along. So my desired table would look like the following
in this table 2010 shows Qty-3 which means 2 was present on site in year 2009 and 1 more was added in 2010 to make the qty 3. I want to write a storedProcedure or something similar to convert the first table into the second table. I said storedProcedure because I am used to doing this in SQL Server.
I have a combo box which displays the primary key. It then takes the other values from the cbo and then displays them in other text boxes in the form. This is great.
I am trying to keep the values in record 1and then move on to record 2. reecord 2 has the same values as in record 1 (the values from the cbo!!!) I am trying to keep the values in record 1 and then go to record 2 and select different values in record 2 from the same cbo. Record 1 and record 2 as well as any other record contain the same values from the cbo.
I am stuck - I am not sure how to rectify this problem so that I can choose different values. The cbo is based on a query from other tables.
Please let me know how to do this as I am still finding this tiresome. Many thanks.
I have built a table off a form that is being used for record keeping and my question is.... This table will be constantly updated with new information so how can I make it to where when new info is added the old info will not be removed or written over?
I would like to execute a code to remove the duplications in the MS Access Query but keeping one one data of the duplications.
For example, in the below data, I want to check for the data in the column Part No. The part number 123 and 234 are repeated twice so I want to delete the part no 123 and 234 that repeated second time and keeping the one data.
I am trying to design a database for an HR management system. I am not very clear on how to handle historic employee data in this database and will need some help and advice please. Any comment you can provide, i'd really appreciate it.
We will like to have record of historic data and the date of change: Employee address change Employee name change Salary change Position/Title change Office location change Number of dependents change Bonus received year-to-year
E.g. if an employee name changes, we should still have to have a record of what the old name was. Scenario: Jacqueline Peters got married 2years after her employment date and now goes by Jackie Harrison (the changed was made on the system), she leaves the firm 10years later. Many years later, someone calls about a Jacqueline Peters that worked here, we have no way of knowing who that is. Now, we would like to the salary she was earning 5years after she started here though her endsalary has changed 10years later she got a big promotion (salary change) and changed department, we have no way of knowing what her salary at a particular time was and what her old title was.
What's the best way to design this database to handle historic data? Have you worked on something similar? How did you go about it? Any ideas and comments will be greatly appreciated.
I have one table which holds the answers to a medical questionaire. 300 questions to be exact. This table has a Primary Key which is just an autonumber.
The problem I have, is that the questionaire results will be updated from time to time. Not the whole questionaire but maybe a couple of fields. Is there a way that the user can go back to the questionaire make the changes needed and then save, but at the same time still keep the original results in the table, but assign a new autonumber? The reason is that they do not want to fill out the whole questionaire again just to make a small change, but I need to keep all the results going back in history!!!!!
Sorry if I havent explained this perfectly. I have looked at the appen query and the update query but not sure if this would be correct procedure.
Thanks in advance. You dont have to tell me exactly how to do it but a hint in the right direction would be nice.:)
High everyone I've had a look around the FAQ's and other threads but haven't been able to find what I'm looking for.
I have a table that contains two fields, one being 'part number' and the other being 'quantity'. Unfortunately there are multiple duplicate 'part numbers'. I am looking at keeping only one instance of the duplicate 'part numbers' but at the same time I want to add the 'quantities' together to keep a running total.
For example:
Before Part Number Quantity a1 1 a2 2 a3 2 a1 1 a2 1 a1 4 a1 1
Does anyone know why when you click on a command button that loads a report it shows it in a print preview mode and then when you click close it closes the report window and changes the form that you were originally on to a much smaller and condensed view instead of being maximised? All the properties are making the form to maximise except when you close from a print preview view. Cheers
I have a database with forms that use ADO to access data files. In the design stage, I went into Tools/References and checked "Microsoft ActiveX Data Objects 2.1 Library", which made the ADO work.
For each "case" that is run, the application creates a separate database and copies all forms, reports, etc into it. In Access 2003, the forms in the new database still have "Microsoft ActiveX Data Objects 2.1 Library" checked, but when I run the application in Access 2007, the forms do not have "Microsoft ActiveX Data Objects 2.1 Library" checked, and the ADO will not work until I go in and manually check it myself.
Is there a way to select the ADO objects programatically or to keep ADO set as a default property in Access 2007? Thanks so much.
I am currently in the middle of creating a database as a means of keeping records of vouchers codes. When someone uses a voucher, I will then be able to input the name of the customer with the voucher code in the form.
This is meant to do two processes:
1. Keep a record of who has used a voucher 2. Check and validate the voucher code (the codes are kept in a table).
Now, I have created 90% of the db to input the customers details etc BUT...I am struggling for the validation part. Ideally, the db would also remove the said voucher code from the table so the same voucher code can not be used more then once.
I was going to "pre-install" the voucher codes in the db and then print off the vouchers for distribution. But I am basically tying to make the system so that it cannot be abused (for obvious reasons)...
I know i could achieve this by creating a view first. For instance by saving this expression as qryCountOfColors
Code: SELECT tblColors.Color, Count(tblColors.Color) AS CountOfColor FROM tblColors GROUP BY tblColors.Color;
And then make the following query
Code: SELECT tblColors.Color, tblColors.Value, qryCountOfColors.CountOfColor FROM tblColors INNER JOIN qryCountOfColors ON tblColors.Color = qryCountOfColors.Color
However I'm woundering wheter or not I could achieve it without creating the qryCountOfColors.I'm myself into a mental meltdown . I've been playing with the idea of creating of creating a subquery to achieve this but im unable to get to work
Code: SELECT tblColors.Color As BANANA, tblColors.Value, (SELECT Count(tblColors.Color) AS CountOfColor FROM tblColors GROUP BY tblColors.Color HAVING (((tblColors.Color)=BANANA))) AS Expr1 FROM tblColors;
How to extract the comment system from the Contacts Web Database template found in Access 2010? I can upload it if you like.
I would like to use it in a standard desktop database to track notes and comments in my records.
I am able to convert it from web to standard, but it still appears to use data macros or something, and my knowledge on macros is limited.
I just want to keep a history of my notes for each record, with the most recent always listed, and the comment system in the Contacts Web Database template seems perfect for that. I just don't know how to implement it into my desktop database.
i have queries and tables with several duplicated "username" records. What should i do to remove the record with a smaller value of "win/loss" and keep the duplicated "username" with a bigger value of "win/loss".
Is there are facility which enables me to keep something like a Notepad text file safely inside the mdb wrapper.
I want to keep notes on what is going on in the database, state of development, reasons why certain decisions have been made, purpose of certain columns (but not as restricted as can be done in Table Design View), instructions for users or developers, or myself, etc, INSIDE THE mdb wrapper.
If I keep these notes in a separate notepad file, it will not go automatically with the mdb file when it is moved, or renamed; or it is not clear where it belongs in case there are different versions, etc.
I am trying to create a simple store keeping In and Out inventory database using Access, I thought I had made it but looks like I am missing something here.
The store works on SRV (Store Receiving Voucher) and SIV (Store Issue Voucher). Products will be added based on SRV and will be issued out based on SIV. So far I have created the tables as you can see in the figure. One thing I am not understanding is where to keep the record of the Current Quantity of each product, lets say an Item has been added or issue out, it should be added or deducted accordingly from that specific products overall quantity. Right now I have a sample field within products table as you can see with the name QtyOnHand but that doesn't seem to be logical.