Right this is a fundamental issue for me here and I cant get my head around the problem!!!
The database I am working on is a database which records the training courses (run by the NHS) which staff at GP surgeries in our area have attended and acts as a booking system for them.
So we have the obvious tables - one for courses (including the name, cost, etc) and then one for course dates (linked by courseID) and one called training_record which contains who went to what when.
It seems simple but it has come to my attention that for example, "Course A" may in fact take place over 2 days, which could be a week apart. The surgeries are billed in one invoice, i.e. Course A would be £100 for 2 days.
How would you recommend I have this data? I can see all sorts of confusion arising... :(
The only way I have thus far thought would be to put each one in like:
course name: cost date
Course A: day 1 £100 - 29/10/2005
Course A: day 2 n/a - 6/10/2005
Course A: day 1 £100 - 01/11/2005
Course A: day 2 n/a - 08/11/2005
However this seems long winded as some courses may be a few days long and this means adding each person to multiple ones!!!!
Any assistance with getting my head around this would be ace! :)
Hi. I have an Access 2000 database running on Windows 2000 Operating System. The database is on a shared drive on a network with approx 20 concurrent users. It runs a bit sluggishly so I am looking for ways to speed things up. The network guys say that the bit rate is OK so I need to tweak the database. I have run the performance and table analysers and get no suggestions for improvement. However, I have spotted a potential problem with the way addresses are stored.
Currently addresses are stored in the person table along with personal stuff like date of birth, gender, ethnicity etc. the address part has six fields:
Oh by the way - this is for the UK so the address structure has to be a bit flexible to accommodate quite a few variations of how addresses can be written but a reasonable guide is:
Number (or house name) and street name (often a second line for part one of address) Village / urban area Town County Postcode
Part one of my question is - is this the best way to store this information or should I just gather it like this on a form and then store it as concatenated text in a single field. I have tried this on a small test database and it works OK and prints address labels etc. - - But is it better or not?
Part two is - should the addresses be stored in the person table at all or should it be in a separate table. This is the bit I cannot get my head round. If it is in a separate table then each record in the table needs to be unique but because of the nature of the client base (i.e. students) many students share accommodation - OK a 1 to many relationship - but what about students in halls of residence they will have an individual room but the remainder of the address is the same. So for say 1000 students in the same hall 95% of the address is repeated although each address is unique overall. And with 4 halls there are 4000 entries that could potentially be reduced to 4 plus a room number and hall name, but I am not at all sure how to achieve this. And then what about addresses for students not in halls but shared houses? I cannot get my head round this. I can see why it was set up the way it was but there must be a better way.
Do I need one table, two tables or six tables (one for each field)?
And how do I then enter data? Do I have to have combo boxes on each line to see if that value has been entered before?
The data gathered would always be entered via forms so I can get the fields together but I don't know how many tables I need nor how best to relate them.
Can anyone suggest how I might get round this problem?
I have a simple modeling question. Lets say I have the following table structure:
Table 1 ------- Cust_id Cust_name Phone City Supplier_id Dept
Table 2 ------- Supplier_id Supplier_name phone City
Table 3 ------- Dept
Table 1 is M-to-1 with Table 3. Table 2 is 1-to-M with Table 1.
I have seen such as schema and do not understand why there needs to be a separate Table 3. Can someone explain why Table 1 alone would not suffice and Table 3 would not be required?
Basically, can someone explain the rationale for normalizing tables when there do not exist sufficient associated data for the field for which a new table is created (i.e. in this example, if Dept had a lot of other fileds associated with it such as Dept_desc, Dept_Mgr etc , then I can see the value in creating a different Dept table and joining it with Cust table through a Dept_id field).
A similar such design exists in the standard "Address Book" sample schema that ships with Access (the analog field in question there is Role).
I'm trying to create a database and it's going well accept for one facet. Some of my recipitents are not known by name. I am planning to use my database to issue letters, newsletters and the like but sometimes they will need to be addressed "Dear sir/madam" instead of "Dear Mr Smith" I was wondering to componsate for that in a database.
I've thought about using a "recipient" field, but I am not sure that would work too well as it would mean an extra field when it might not be needed (I can get "Dear Mr Smith" from fields such as Title and LastName).
I can't really get my head around it :(
One thing: Please don't think of me as some annoying mail-spam person. In truth I am a member of a charity but some of the businesses and charitable foundations we appeal to don't have named members for us to address letters to. Hence we need to use Dear Sir/Madam and the like.
:)
Please help me. I've hit my head on the wall so many times that I think I am going to demolish it!!
Not sure if anyone can help but I have an issue I would love to sort out.
Each week I load several excel spreadsheets into an access database (one table) in order that I can check for duplicates across previous weeks and that week (with in excess of 20,000 records on each excel sheet). I created a find duplicate query to identify the records so I can use it to obtain credits. Unfortuantely I am not in control of the data coming to me (or else I would prevent duplicates at source)
Im not sure if this is the best way to try and do this or not. Any comments are greatly appreciated.
Basically I have my general employee information in the tblemployee table, the workcenter information in the tblworkcenter, and the manager of the Workcenter in the tblManager. This is correct for 99% of the employee population. however, there are a few employees whose manager isn't the 'general' manager for the employees assigned workcenter.
How I can adjust an individual employees manager, while maintaining my structure? or would i have to go back and add the managers ID to a field in the tblEmployee Table?
Here is what I want to do: I'm organising 15 training events, for 60 participants. These 15 training events fall in three themes: running, swimming, cycling. So there are 5 training events held on running, 5 on swimming, 5 on cycling. Each has on average 4 participants, but in reality, some have 6, some 2.
Everybody has to attend each of the three themes, so three of the 15 events.
I have a table called "events". each record contains data on a certain event (place, date, speaker, participants,...)
I have a table of 60 participants, with: their names, their age
Per event, I want to indicate who is participating, with a combobox. Now, the number of participants per event is not limited, so it could be 5 or 30.
Also, it could be nice if the combobox content is limited to the people that haven't been selected yet. So if John Doe is already taking the swimming training in event Swimming1, if I pull down the list of participants in event Swimming2, I do not want to see John Doe's name there.
Also, I want to calculate the average age of all the participants of a certain event.
I want to print out two reports: 1) per training event, an overview 2) per participant, an overview of all the events he has inscribed to
How do I go about this? Currently I am using 30 comboboxes, and 30 fields in the table "events", called participant1, participant2, participant3,..., participant30 But it is becoming messy, and when I ask for a report per participant, he only gives me the details for the people in participant1.
Access front end, SQL Server backend. ---- I have a continuous subform (part of a tab control on a main form) whose name and sourceobject are both "sbfCannulae". There are about 10 fields on the subform, and all are bound to fields in a table. The primary key of this table must be generated by combining two other fields, which must happen just before the record is saved. (I know calculated data should not usually be saved in tables, but trust me. In this case it is necessary.)
Right now the user COULD enter data into the primary key-bound textbox, but since the user is me, I make sure not to do that.
When I enter data into all fields except the primary key, I get an error because the primary key cannot contains nulls...of course.
I use the following code to tell me when an event has been triggered.
Code associated with sbfCannulae: Option Compare Database
Private Sub Form_Activate() MsgBox "cann activate" End Sub
Private Sub Form_BeforeInsert(Cancel As Integer) MsgBox "cann before insert" End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer) MsgBox "cann before update" End Sub
Private Sub Form_Current() MsgBox "cann current" End Sub
Private Sub Form_Dirty(Cancel As Integer) MsgBox "cann dirty"
End Sub
When I enter data into a new record, the Dirty event is triggered, but I cannot for the life of me figure out how to trigger any of the other events. No combination of values and nulls in any fields, clicking in other tabs, clicking to other records, or using the navigation buttons will ever trigger any events but Dirty.
The only msgbox I ever get is the one giving delivering the SQL error about the primary keys not taking null values.
I request your comments please... I have a form with bound and unbound fields and have linked the [Event Procedure] on these fields base on there respective action.
Now when I open or click a particular field with the event procedure, the procedure is names are like - Private Sub Rate_Exit(Cancel As Integer) or Private Sub Quantity_Exit(Cancel As Integer)
but others events are name like Private Sub Quantity_Enter() simple. Why is that ms access (Cancel As Integer) uses only for specific events only.
I have a main form that calls several other forms for the user to input data. When the user closes one of the sub forms I would like to know what event is fired when the main form gets the focus back. I have tried several different events and can not figure out which one will work. Hopefully someone knows the answer I'm going crazy tring to figure it out, oh wait I'm already there.
I have a database in which people add little bits to different fields as they go. For instance, person 1 puts in appointment, person 2 verifies info for the customer, person 3 checks the customer in, person 4 takes their money. What I am trying to do in a form is track the time when each department accessed it, and which user. I can do this on a new record, but for some reason, I can't get the event properties to work correctly on my form. I have a field for each department set aside for when they update their part of the record. What I am trying to do is, when the record is updated, having the time autopopulate the field.
Example:
Appointments enters |DATE OF APPT| |TIME OF APPT| Appointment timestamp should = time()
Reception enters |PULL TAB#| |CHECKED IN y/n| Reception timestamp should = time()
Cashier enters |AMOUNT COLLECTED| Cashier timestamp should = time()
All of these fields are on the same database (I have 2 linked tables: Customer demographics and appointments linked one to many by account # for the customer), and obviously, there's a lot more to it, but this is just a short example of what each department will enter. Appointments starts the appointment, so their timestamp will work, as they are starting new record. However, all of the following departments will be adding to this appointment record. When the other departments open their form with the fields in which they will be filling out, I want it to timestamp when they update the record as well as inserting their login "currentuser()" into the "updated by?" field for each department. For some reason, when I put time() into the event portion the field, it doesn't work. I tried it on dirty, on exit, after update, and it just doesn't update. Am I missing something?
i have a calendar that works like a charm, but i would like to add the possibility to add recurrent events in it. for instance if a user has to perform a task at a choosen time schedule, it is shown in the agenda, like each week or each two weeks or each month. Anybody any idea how i would aproach this problem or has a sollution?
I try to implement a function that looks for broken references in my Access project, so that I won't need to modify the needed references for every workstation. Here's my problem: Where could I put the call of this function so that this code will run before trying to compile the forms and, as a result, avoiding the compile error that access pops-up when a reference is broken or missing.
I have a series of events that have a start date and an end date. How do I write an append query to append an event to a table as an individual event for every day in the given range?
I have a start and end date fields plus a txt box called wDays. I'm trying to make sure the user puts in both dates but end cant be earlier than start and vs versa.... If not provide a message as to which is missing.... If alls well do the calulation with the module "GetWorkDays" I f everything goes bad, dont save the record at all!
I have this behind a cmdButton. Used to unhide the wDays field because it displays #error otherwise...and to do the calculation... with the BeforeUpdate Private Sub Command8_Click() If IsNull(Me.sDate) Then MsgBox "Please enter a Start Date" ElseIf IsNull(Me.eDate) Then MsgBox "Please enter a End Date" Else If Me.eDate < Me.sDate Then MsgBox "End Date cannot be earlier than the Start Date" Exit Sub End If End If Me.Requery End Sub
Private Sub Form_BeforeUpdate(Cancel As Integer) Dim myDays As Integer If IsNull(Me.eDate) Or IsNull(Me.sDate) Then Me.wDays.Visible = False Else Me.wDays.Visible = True myDays = GetWorkDays([sDate], [eDate]) Me.wDays.Value = myDays End If End Sub
Any help would be really appreaciated because I have tried many combonations of code placement to get it working correctly....
I have a split, shared database in which the Before and AfterUpdate events on my forms are not working at all. I tried setting a breakpoint to verify this and, sure enough, they are not firing.
Does anyone have any clue as to why this may be occurring?
Thanks so much for the help. I have tried searching the forum with no luck.
I have a form with a number of controls with code behind - this works as required.
However, recently I decided to use a tabbed control to hold the controls and simply cut/pasted these control onto one of the pages of the tab control. The events now no longer fire as they did and I have no functionality on the form - the code still exists in the design of the form though..... any ideas?
I have a form where I want to validate enties before moving off the record.
I put my validation in the BeforeUpdate event of the form. If validation fails, then I set Cancel=True. So far, so good.
But if the user closes the form (either with my close button, or the standard close button), or presses 'Page down' to move to the next record, then even if validation fails, the form will close (or move record). What I want is for the user to be left with the form open, on the current record.
Ii there such a thing as events fired by Navigation? I have a Form displaying records in a Datasheet which has a Navigation control and I need to be able to detect when the User selects various parts of this control.
I am just starting find my way around Microsoft Access However I am currently stuck on something to do with table events (data macros).I added a Before Change and After Update macro to a table and added a RaiseError method to each of them.
I tried to update a record in the table. A dialog appears corresponding to the Before Change method. I deleted the Before Change method and then once again tried to update the table. No dialog box appears The After Update macro does not seem to fire.I tried all the other "After Events" and nothing seems to fire.
I re-arranged things in the code to try to make it clear as to whats going on. But I'm at a loss to why the qry will only run once. When I open the db and add a new record it works, when I try to add the next one, it doesnt....
Is this an issue with Access or is it me? I stripped it down in case someone could look at it....
The a mousehook module in the db to prevent scrolling..
I have a table, part of which includes a [start date] and [end date]. I need to be able to plot a graph that will show, for each month, how many projects were still open. they will at the start of the month have a [start date] but no [end date]. I have created another table that holds the date for the first of every month in the range that I am intrested in. I suspect I need to use a subquery in here somewehre but cant get my brain around it :(
Does anyone know of a good resource (thread? website? whatever..) where i could learn the basics of programming Events? I'm not looking for anything too advanced, just the basic stuff that one needs to design a user friendly database.
I use the events afterInsert of a Form frmA and the onChange of a field in the same form in order to make some changes to another Form frmB.
Everything goes as expected when the field (with the onChange event assigned) of an existing record changes. The problem starts when I add a new record which triggers both AfterInsert event (desired) and onChage event (undesired).
Is there a trick to separate the two events? Basically I want to call a Sub when the data on the field change (onChange) and a different Sub when I add a new record (AfterInsert).