Preventing Opening A Form Unless Data Is Entered? And Some Other Q's.
Oct 29, 2006
Hello again,
I have three questions this time 'round:
1. I'm in need of some way of preventing a user from opening form B unless he has entered information in form A.
Right now it is possible to open form B without entering data in form A (form A being the date/time info and form B being the case technical info) due to which a record is created for clientnr 0 (which should be a non existing client). Querying for clientnr 0 from time to time and deleting those records is easy enough, but who knows what kind of relevant data could be stored accidentally in a record that doesn't belong there.
This happens by the way, even though referential integrity is enforced throughout the dbase. Maybe I should say, because of that. I want to keep it that way of course to prevent orphans roaming around. But having orphans for clientnr. 0 is also not a good idea.
2. What is the wiser thing to do: keep all information concerning one case for one client (date/time info per case, techinfo per case, maybe even products sold info per case, payment info per case) in one table and have the data needed for each thing entered in seperate forms, or have all data split up into seperate tables like I have now. One for clients, one for dates and times, one for the technical info for that case etc.... ?
It is starting to seem a bit ehrm... useless to have all that data for one case floating around seperate tables. I don't know... it seems so much more complex (having to create multiple relations, multiple PK's per table etc.).
Where do I draw the line? For example the image attached (relationship2.jpg): now I have one PK in the table holding the clients (clientnr), two PK's in the table holding the case date/time info (clientnr and casenumberdatetimeinfo), three PK's in the table holding the techinfo (clientnr, casenumberdatetimeinfo and casetechinfonr). And what's next? Four PK's in the table holding the sold productsinfo? Five PK's in the table holding the invoice info? And what about the relations between those tables? Right now I can still comprehend.... but when I start thinking ahead, I'm starting to get dizzy. So some advice on this would really be highly appreciated.
3. Which build up of the relations between the tables in the dbase is better? The one in relationship.jpg or the one in relationship2.jpg?
I have a form which allows the user to book rooms.
On this form, there are the following fields:
BookingID: (Autonumber) RoomID: Text box Time:Text Box Date: Text Box Class: Text Box Teacher: Text Box
The form adds this information to the Booking table.
What I'm looking to do is prevent the user from double booking a room,like being able to check if the Room is already booked at that time and date, before the new information is added to the table and the room becomes double booked.
Basically this would be checking the RoomID, Time and Date fields, as everything else is irrelevant. What would be the best way to do this?
I'm using the following code to ask the user whether to save changes to the data, don't save changes or Cancel the close and continue editing. I'm closing the form using the 'X' only.
Code:
Private Sub Form_BeforeUpdate(Cancel As Integer) Dim UserResp As Integer UserResp = MsgBox("Record(s) have been added or changed." & vbCrLf & "Save the changes?", vbYesNoCancel) Select Case UserResp
[Code] ....
The problem I'm having is when I press the 'Cancel' button in the message box. When I press 'Cancel' the form remains open (bPreventClose=True) which is what I want. But the changes to the data get undone even though I don't have Me.Undo in that case.
First, what's causing the undo? Second, how do I prevent the data from undoing when I press 'Cancel.'
I went to add a record earlier and selected 'Cancel' because I wanted to change one small item. I lost all the data I had put in and had to start over.
I am fairly new to access but so far I have been able to get what i need from it, until now. I am trying to find a way of comparing two sets of data to find out an employee's average productivty.
Table 1 -Hours Worked (by day) - contains 'name' 'date' and '# of hours' worked - an employee would enter the hours here on a daily basis
Table 2 - Contracts Keyed (by month) - contains the number of contracts worked that is derived from seperate system - this is entered on a monthly basis (so for example: John keyed 30 contracts for the month of January) - the system i am pulling this info from does not have the ability to pull a daily count of contract per employee, only a range of dates and it then provides the sum for that range (unless I ran a query for each day, for each employee which would take me hours) - employees dont have access to this system to enter their own # of contracts keyed on a daily basis. - for entry, so far i have just been putting the first of the month and then the # of contracts.
In a nutshell, this is the calculation I am trying to create:
(Sum of "# of hours" for the month) / (total "# of contracts keyed" for the month) = employees average hourly productivity.
I have tried to do this with various types of queries and reports but with no luck, I get a prompt saying that access can't compare the 2 fields.
Is there a way to compare the data that is entered daily with the data i would enter monthly?
I have a form with several tabs on it, where the user enters various info.. I want to have the user hit the save button and have all info saved to a single table. Is there an easy way to do this. Please excuse my ignorance but I am fairly new to Access. Thanks in advance!
This is my first question posted on this site. I have created a survey with questions to be answered. The database is already populated with records of the people's names who were getting the survey. What I need is when the data entry clerk brings up the customer's name on the form, is that they are forced to enter the surveys answers for certain questions before they click the "Save" button. The answers are set up as radio buttons on the form (ie Less than 6 Months, 6 Months, 8 months and 1 Year).
Not sure if a Before or AfterUpdate macro is needed?
Any suggestions would be appreciated. Please email me directly if you have code.
I have a form where users enter data in various ways - combo boxes with drop down selections and text boxes where users manually enter some data. I also have several text boxes that return "answers" based on calculations from user entries mentioned above. The form is bound to a table where all the entered data is stored. I'm having trouble saving the calculated information to the bound table. It's easy in all the non-calced boxes, I just put the column name of the bound table in the control source, but in the calculated fields, I already have the formula in the control source. How can I identify the proper column to save the data in this case.
I am not sure where this thread should be in forms or queries. I have database which has 3 linked tables by ID in each table. I have built a query on the 3 tables, then created the form.
Now when I enter data on the form and save it, when I open up the said form again , the data is not there. Yet the data is in both the table and query
If I only use 1 table, then there is no problem. The record source for the form is the query, and the query uses the 3 tables.
I have a form that the user enters employees daily duties. I have code to run sql after the BoxNum field has data in it. I want it to look at the BoxNum field and the dropdown box for the task to see if the entered box number has already been completed for the task selected on the form. Here is what my code looks like now. The code runs but gives me the msgbox no matter if it is a made up box number and I also get a syntax error 3075.
Code:
Private Sub Text13_BeforeUpdate(Cancel As Integer) Dim rs As DAO.Recordset Dim strSQL As String
Can someone go through my forms and help me figure out why I cannot submit the entered data. Whenever I try to test my system and enter in inspection information I get an error that says....
"The changes you requested to the table were not successful because they would create duplicate values in the index, primary key, or relationship. Change the data and try again."
Steps:
1.) Type the given sample account number in the blue box 2.) Click "Search Acct #" button 3.) Click "Test" button 4.) Enter random info on the test form 5.) Read error message 6.) Help Ken_C :D
I am developing a form where students have to enter their ID number but I want my form to check through a table of students and their IDs and flag up if the ID number does not exist in the table.
I have a parameter form I used to enter data for a query. I want it to clear any previous data entered when it opens. I have tried the below without success. I also have the fields defaults set as "" and the form set at yes on data entry.
Private Sub Form_Open(Cancel As Integer) Me.BldgCmb.Value = "" Me.StateCmb.Value = "" Me.CityCmb.Value = "" Me.AddCmb.Value = "" End Sub
I am attempting my first access database which tracks blood components in our medical facility. When a component is issued to a patient there is a button to push which links to a report that runs a query. The user must enter the unique key for the component at a promt, which ensures the report generated will be for that component only. My question is if there is a way to cpture and use that key automatically when pressing the button. If I need to clarify something, please let me know--I may not have the Access developer lingo down yet...
I have a main form titled "projects" with a subform titled "inventory". They are linked by two fields "project" and "fiscal year" with a one to many relationship. These fields are also the primary keys in the main form. I also have the referential integrity option activated.
Whenever data is entered in the subform inventory, it duplicates the main form and all the other subforms linked to the main form. (I have about 11 other subforms linked to the main form). So if I enter 2 records in the inventory tab, there will be 2 records for the same project and fiscal year in the subform and all the other linked subforms with the same data, so it is almost like it is seeing the inventory subform as the main form. I have tried deleting the duplicate record from the main form, then it deletes the 2nd entry of the subform. I have attached a pdf with a print screen of the 2 duplicate records with the same fiscal year and project name.
I have another form called Notes that has a similar relationship, but doesn't have this problem. I think it might have something to do with the conversion. I originally created the database with Access 97 and we are now using Access 2007. Am I missing something that needs to be done in Access 2007 to link the 2 forms, so I can enter records in the subform without duplications?
Also, the database is split so there is a back end and front end. I have all the tables and relationships set in the back end.
I want to check if data entered in a form field is existed
The form is bounded to a table
I used this code
If DLookup("Telegram_Number", "tbl_Violation_Of_Building", "Telegram_Number Like " & Forms!frm_Add_Violation_Building!Telegram_Number) Then MsgBox ("number existed") Me.Telegram_Number = "" Else End If
everything is ok but if the data is existed the database show the message and clear the field but i'm getting a Run-time error
'-2147352567(80020009)': the macro or function set to the beforeupdate or validationRule property for this field is preventing [ISF] from saving the data in the field
I guess the problem because the form is bounded to a table so he will save automatically
My solution is to unbound the fields and save the data via vba but is there any solution with a bounded form???
I have a database (split into front and backend). Users populate the table using a form on the front end. Recently, it has been pointed out that some of the data entered into one specific textbox is being changed on the table. The data entered is always has a minimum of a letter and number value i.e. "A1", "A2" etc. Upon examining the table, this has changed into numeric values i.e. "1291", "1061", "852"... etc. Looks like it is translating them into both 3 and 4 digit numerical values by the looks of things. Where more complex data is entered such as "2(A1, A2)" these seem unaffected.
The field is set to text, I have set no validation rule, format or input mask. Just can't see why access is changing these values. It seems to be translating them, but I can't see a pattern.
I have a form that request the User to enter a Parcel ID number (99-9a-99-99aaa-aaa-aaaa). The sub form asks for the subdivision number, block number, and lot number. The subdivision number, block number and lot number are normally part of the Parcel ID number but sometimes they can be different. I want the sub form to fill in the Subdivision number, block number, and lot number as a default but allow the user to change the value if needed. currently the sub form will only show what is entered into the table itself if a change is made on the main form the sub form does not reflect the change.
I have been tasked with creating a tool to analyse mobile phone bill data and present the analysis, and our recommendation, to a customers. Being new to Access (other than basic tuition) this has been a slow uphill task, which is finally nearing completion, however there is a problem which I have not yet been able to overcome.
The requirement is for the DB to open first on a splash screen (lets call it Form A) with fancy picture where our customer is selected from a combo box, the customer is then telephoned, a linked computer screen is established and our staff then click "Go" to proceed to a second form (Form B) showing an account overview and more details.
The problem I have is when "Go" is clicked, the second form loads via on click event, and even populates the correct customer in its combo box. Unfortunately that is as far as it gets - the combo does not look up the information. The customer needs to be selected again for the subforms and subreports to load with the customer overview. To clarify, form B just sits there blank until the customer is re-selcted from the combo box in form B.
I have developed a database in Access which has user permissions implemented. These are set so that only Full Data Users have permission to delete information.
However, it has come to my attention that users can get around this by creating a query and then deleting records displayed in its results. I can't understand why this is possible, because the permissions should prevent this.
Hi people. I'm having fun with this one. I want to open a form frmOldRec from a list on frmSelectOld, only if there is data. I'e tried code such as: Private Sub Form_Load()
Dim rst As Recordset Set rst = Me.RecordsetClone
If rst.RecordCount = 0 Then MsgBox "No Records logged in this service area"
DoCmd.Restore,
'close etc etc
End sub
But I haven't been successful.
As it stands it opens a blank form if there's no suitable record. How can I stop this happening please?
What I have is a database that I am using for 3 different sites; NE, NCA, & SCA. What I want to do is have the form ONLY show information for the specific site that the Leader is a member of. I have a security table that contains the persons name, & site location. For example: John Smith works at the NE site; so when he goes to open a form to add/modify/delete members from his site I want him to only be able to see date for NE from the table. So in the listbox NCA & SCA would be filtered.
How can I go about doing this? The forms Record Source is set to the Security Table. Please help so I can do this without having to create a seperate form for each different location. :)
I currently have two froms, "add record" and "add record cont." The reason I have two seperate forms is because when clients create a new record information needs to be saved to two different tables and when creating one from with fields from both tables I ran into many problems. The two tables are named : tblMain, tblFileLoc Currently there is a textbox on both forms named "fileID" the FileID in the first form is from tblMain and is the primary key for that table, the FileID on the second form "Add Record Cont." is just a normal field. When clients enter in the new FileID in the first form "Add Record" and then move onto the next form "Add Record Cont." i need access to bring the entered FileID from the first form and Fill it in the FileID field in the second form. Currently I have tried making the control source for the textbox on the second form = the textbox on the first form but it brought up an error.
IThe db has a form called ClientFormNew which logs client details into a table called Clients.Each client has a unique client ID in the table called ClientID. Sometimes Clients call back for further information and we want to log that information into a related table called ClientHistory.Each record in the ClientHistory table has a unique ID called HistoryID which is the same number as the ClientID so these fields are related.
When a client calls back and the telephone adviser opens up the ClientFormNew form and discovers they have called before they need to click on a button called Client History which then opens up the ClientHistoryForm..I am struggling with the code to put on the Client History button as I want the new form to display the details of the clients first contact then allow details of the second contact to be added in a new row. Also the new form needs to show all that client past history which would be in the form of the following fields from the ClientHistory table.HistoryID, ContactDate, Name, ContactMethod, ContactReason, AdviceGiven, Notes.
I have been having problems with opening a form to add new records only. I have gone through all possible solutions but somehow the problem persists.I want to add new records only and not view any of the existing records. I have set the form properties to Date Entry Yes, Allow additions to Yes, Allow Edits to No. The form opens through a command button on another form and the vba code is the following.