Hello all
I am having a problem with my vb code. I am realatively new to vb and what I am trying to do is search through a table according to what is selected on my form and delete the values that equal the value selected int the table. What I have so far is this
Private Sub cmdDel_Click()
Dim rsSource As DAO.Recordset
Dim rsDestination As DAO.Recordset
Dim theBug As String
Dim SelItm As Control
Set SelItm = Me.Users
If Me.Schedule.ItemsSelected.Count = 0 Then
Beep
Exit Sub
End If
Set rsDestination = _
CurrentDb.OpenRecordset("User_Course_Room", _
dbOpenDynaset)
For Each Itm In Me.Schedule.ItemsSelected
rsDestination.FindFirst "User_ID = " & Me.Users & "" And "Course_Room_ID = " & Me.Schedule.ItemData(Itm) & "" ### THIS LINE GIVES ME A ERROR
'rsDestination!Course_Room_ID = Me.Schedule.ItemData(Itm)
'rsDestination.FindFirst "Course_Room_ID = " & Me.Schedule.ItemData(Itm) & ""
rsDestination.Edit
rsDestination.Delete
Next Itm
Me.Sessions.Requery
Me.Schedule.Requery
End Sub
In the line with the bold writing next to it I get an error. What I am trying to do is search for the record with the user id selected and the course room id seleceted and delete that record but I get an error. Any help would be highly appreciated.
A record in a table linked to various others has recently been corrupted in my database. When i try to delete the record an error message appears telling me that the 'Search key was not found in any record' and the record will not be deleted. This corrupted record is causing me serious problems and i need rid of it by the end of the day.
I am having a problem with all of my comment fields showing up as Japanese and I need to get some reports printed... Does anyone know how or why this would or could happen?
I have checked the tables but they are normal. When you query the tables is when the comments start to mess up.
Hello, I'm new to the board and I need an urgent problem fixed. Ok, I have a query that contains the type of TRAINING REQUIRED FOR EACH POSITION/PERSON IN A COMPANY . It has:-
1. Clock no. (uniqe for each employee) 2. Job Title 3. Position effective date 4. Training code 5. Description of training code 6. Retrain requirements ( number of days that are needed after initial training to reach retraining date, this varies from 0 to 365 days depending on the code) 7. Status of employee (whether active or inactive, the criteria for this is active) 8. Due date for completed training
I have another query which shows the TRAINING RECEIVED FOR EACH EMPLOYEE. IT has:-
1. Clock no. 2. Job title 3.Last names (employee) 4. First name 5. Status of employee 6. Training code 7. Date of training received
QUESTION IS HOW DO I CREATE I GUESS ANOTHER QUERY THAT WILL TELL ME WHAT REQUIRED TRAINING CODES THAT EACH EMPLOYEE HAS NOT RECEIVED? I BASICALLY NEED TO KNOW IF EVERY EMPLOYEE HAS BEEN TRAINED CORRECTLY ACCORDING TO THEIR POSITION OR NOT.
I need to make a database for a association and collect the Business information and Personal information the following information is needed For business Business name Corporation Name Address city state Zip Code County Phone fax then Type alcahol yes/no tobacco yes/no EIn number STI Number Sale tax Number
Personal
Name Address city state zip phone cell email
*some things one owner might have more than one store. i can make the form and everything just need help with relationships and that quiries that sort of stuff.
hi i am making a database for a company, in which i have the feild "joining date" and the feild "paymant method" which can either be yearly or half yearly
im looking for a quiery that will work out who need to pay when and also i need it to bring them up two weeks before due payment..... im then going to mailmerge them.. which i am not 100% sure how to do. :eek:
Hi. I am creating a website for my employees. I have created a table, query and a form in microsoft access containing a lot of different fields, including employee ID and password. I have also created a form in Dreamweaver. How do i link the database to the form and how do i create a code that will log in the employee if his password and username are correct, into a new page and if the info is wrong, to another page. PLEASE HELP. This is very very urgent!
"The Visual Basic for applications project in the database is corrupt."
I've had a quick search but can't find a solution. This db has always been access 2003 (Not converted from prior file version). I can't even import into a blank db as the same error occurs.
Hello all being my first post i will try and make this as clear as possible...
its a new system my company.
my manager would like if possible the system to work in this way..
firstly a form whcih will book rides so when opened will ask current members to etner their card no which is a 16 digit number always beggining with 5555 1946 and the customer no. added on which is 0000 0001.
If a customer has not registered another link so they can register and enter details and once done this press enter and message generating a new 16 digit card number 1 mroe than the highest number in the system. new members are allocated 2000 points on their card and points are taken off when booking new rides plus a 10 point booking fee.
then a button will be clicked to take back to reserve rides which allows the customer to book a ride using the ride id and ride number on a specific Session of which there are 3 times in the day 11:00, 14:00 and 17:00 and with a maximum of 5 places on each ride during each session being able to book.
once session ID and time,date selected the next box should show the available rides
if member does not have enough points to book an error message is displayed.
I know this all sounds confusing and ive attached my progress so far its very basic being a basic user i hope users out there can help as this has to be done before friday
Basicly I am doing an Access Project for my school coursework, but I am really confused and my teacher isn't that great.
My coursework is based on a video rental company. The database (in breif) has to be able to bring up a customers details, and add a loan to/under that customers details. (as you would expect from a video shop).
Now, to be honest, I dont know if I have the correct items in each table, but was wondering if someone would be so kind to have a quick look to tell me what to change and where to put the relationships for the database to work correctly.
I have taken a screen shot of my current database: http://img259.imageshack.us/img259/8216/accessproblem4de.th.jpg (http://img259.imageshack.us/my.php?image=accessproblem4de.jpg)
If you would like any other information, please let me know. I am really grateful for this!
I have used sum() function in a query where I have got other attributes. However, the sum() doesn't work for some reason.
I could not attach my database as its size is too big. i have uploaded it to this server where you can download it. aimreda.co.uk/db (http://aimreda.co.uk/db)
Original Table ozip dzip shipdate wgt Transport cost
A B 12/1/07 20 450 C D 4/1/08 15 890 E F 9/1/08 78 750 A B 12/1/07 42 789 X Y 1/1/08 17 900 C D 4/1/08 34 90
Needed Output
ozip dzip shipdate wgt Transport cost
A B 12/1/07 20 450 A B 12/1/07 42 789 E F 9/1/08 78 750
I need to create a query which extracts rows with wgt >60 and also WHEN the fields ozip, dzip and shipdate are same, the query should add the wgts and then sum of wgts should be >60- for example the first and fifth rows should be extracted since sum is 62.
I have attached the output that is required for the above example. please help
Hi all, i need some help constructing a query that will create a table for me that does not include the Type value of 'promotion' if the same ID value exists elsewhere within the query.For instance, in the example below, i would want to delete the first entry containing 'Promotion' because ID2001 exists in two other places. However, if only one instance of ID2001 'Promotion' existed in my query, i would want to keep that entry. I would prefer to write all my data to a new table called "Test", This query has to sort out about 1000 entries when executed, otherwise i'd do it manually.I'm pulling my hair out with this one, so could someone help me?ID Company Name TypeID2001 Disc plc John PromotionID2001 Disc plc Paul AgentID2001 Disc plc George Agent
I'm looking for advice on the best method to accomplish the following from the esteemed members of this Forum (You all have provided excellent advice in the past to this Access Dummy, with my thanks), (I've also searched the forums without result):
I would like to make several fields "required" fields on my form, easy enough, in that I set the Required property on the table to "Yes".
What I would like to happen on the form is that when a user tabs out of a required field, a message box pops up that says "This is a required field" and/or when they click any of the following command buttons I've created, "Save Record", "New Record" or "Close Form", that a message box pop up and list the required fields that they missed.
Any ideas, with code, macros, or other solutions would be greatly appreciated, keeping in mind that I'm just not that swift to start with.
ok what follows is a kind of pseudocode of what I'm trying to do. It would really help if someone could tell me how to get a command button to do the following startin by the copying of fields into a new record in a table and then using that table to do the required actions. Any help would be greatly appreciated and yes it is urgent as the assignment is due in on Wednesday.
Copy fields into new record in table Transactions If [Transaction.In or Out] = In Then
I have Header form and subform subform in it with following fields
Subform fields are :
1. MQE_No : (Text field as it will be like MG-120, MG230), Duplicate OK) 2. RPO_No : (Number field – Double, Duplicate OK ) The are project no. 3. ForemanNo (Number field – Long Int – Duplicate OK)
Header form fields are ;
1.ForemanNo – Long Int – No Duplicate 2.Other fields…
The subform field have ForemanNo One-To-many relationship with Header form.
Following project MG-411 need to enter (assign) to foreman no. 641
Actual data to store in subform
MG-411 (MQE_NO) 5421654 (RPO_NO) 641 (FOREMANNO)
I started to enter data into subform selecting the ForemanNo at header so records to enter in specific foremans account. Everything is fine here.
What I need is:
I would like to select / add another Foreman into the header and start entering same above data for another Foreman. Bcz sometimes we need to do like this in case previous Foreman may go on to a week vacation. We can not stop project for a week. So need to assign project to other foreman.
When selected the Project (MG-411) thru a combo to assign it with other foreman, it should give a short msg to user that this project has already been assigned to “XYZ” forman. Need to assign again “ (Y/N box )
If Y then data entered otherwise cancelled.
To achieve this, I did the following but only 50% success. (Used Cmbo CboRPO2 select MQE_NO). Tried to satisfy both condition but no use.
Private Sub CboRPO_AfterUpdate() If DCount("*", "T_RPO_Footer", "RPO_No = " & RPO_No) > 0 And DCount("*", "T_RPO_Footer", "ENO = " & ENO) Then MsgBox "RPO ALREADY ASSIGNED TO SOMEONE / FOREMAN", vbOKCancel, "WARNING!!!" Me.Undo Exit Sub Else
Dim Msg, STYLE, TITLE, HELP, CTXT, Response, MYSTRING If DCount("*", "T_RPO_Footer", "RPO_No = " & RPO_No) > 0 And DCount("*", "T_RPO_Footer", "ENO <> " & ENO) Then Msg = "RPO ALREADY EXIST WITH OTHERFOREMAN, ASSIGN AGAIN TO ANOTHER ?" STYLE = vbYesNo + vbInformation + vbDefaultButton2 TITLE = "!! ATTENTION !!" HELP = "TEST FILE" CTXT = 1000 Response = MsgBox(Msg, STYLE, TITLE, HELP, CTXT)
Else Me.MQE_NO = Me.CboRPO.Column(0) Me.RPO_No = Me.CboRPO.Column(1) Me.WORKSHEET_NO = Me.CboRPO.Column(2) Me.WORKORDER_NO = Me.CboRPO.Column(3) Me.WORK_DESC = Me.CboRPO.Column(4) Me.PL = Me.CboRPO.Column(5) Me.PipeLineKM = Me.CboRPO.Column(6) Me.DiaMeter = Me.CboRPO.Column(7) Me.PipeLength = Me.CboRPO.Column(8) Me.PipeLineArea = Me.CboRPO.Column(9) Me.P = Me.CboRPO.Column(10) Me.RPO_AMOUNT = Me.CboRPO.Column(12) Me.INV_AMOUNT = Me.CboRPO.Column(13) Me.Status = "WIP" Me.StatusID = 2 Me.CboStatus.SetFocus End If End If End Sub
I tried with following code also
'Dim cdn As String 'cdn = "[MQE_NO] = '" & Nz(CboRPO, "") & "'" 'cdn = cdn & " And ENO = " & ENO
'If DCount("*", "T_RPO_Footer", cdn) > 0 Then 'MsgBox "THIS RPO ALREADY ASSIGNED TO THIS FOREMAN", vbOKOnly, "WARNING!!!" 'Me.Undo 'Exit Sub 'Else ‘do something ‘End if
Hi All, Is it possible to have just one instance of this message box fire when one or all or any number of the flags are triggered. At the moment if 2 flags are set then 2 messgage boxes appear,if 3 then 3 messages etc. My code at the moment is below to trigger the message box, hope I make my self clear;can it be tidied up?
private Sub Form_Current() If Me.Flag1 = "Patient Alert. HIGH RISK. Med Hist" Then MsgBox "**WARNING PATIENT ALERTS DETECTED**Read all patient alerts before treatment" End If If Me.Flag2 = "Patient Alert. ALLERGY. Med Cond" Then MsgBox "**WARNING PATIENT ALERTS DETECTED**Read all patient alerts before treatment" End If If Me.Flag3 = "Patient Alert. Cat Score. LOW. Caution See Notes" Then MsgBox "**WARNING PATIENT ALERTS DETECTED**Read all patient alerts before treatment" End If If Me.Flag4 = "Patient Alert. PATHOLOGY. Int/Ext Exam" Then MsgBox "**WARNING PATIENT ALERTS DETECTED**Read all patient alerts before treatment" End If End Sub
Hi All,:confused: need some code help again, I dont seem to be able to get the hang of message boxes!! The code below takes the path to a mdb file which is stored in a text box on my form, it then deletes an existing table -Expire-and replaces it with a new table also called Expire from the database located at the file path in the text box.
Private Sub Command6_Click() Dim tmpFilePath As String tmpFilePath = Me!Text1
I have the following code and wish to change the Weights.Collected field to True from false in the new query (expr3: ) in the new query.
Thanks
Private Sub cmdBuildQuery_Click() On Error GoTo Err_BuildQry Dim strSQL As String Dim qdf As DAO.querydef strSQL = "SELECT TOP " strSQL = strSQL & Me.txtNumberToGet strSQL = strSQL & " weights.Weights, Weights.DocketNo, Weights.Collected, Weights.UKBulk, Weights.weighttime FROM CollectionQry " strSQL = strSQL & "ORDER BY ([id]);"
DoCmd.OpenQuery "appendUkBulk" DoCmd.OpenQuery "qryCollectYorks" Exit_BuildQry: Exit Sub Err_BuildQry: If Err.Number = 7874 Then Resume Next Else MsgBox Err.Number & " - " & Err.Description Resume Exit_BuildQry End If End Sub
I have a database of employees, sales, products(Sky and Mobile Phone Contracts) and customers(Need to be common and shared between all products). ( A door-to-door marketing company)
Since each product requires different inputting tables, I have inserted all the required fields into the tblSales and then I want to run a query in order to select the needed fields and create a new Sale of a specific product.
However at the same time I want to create a new customer, assign the sale to an employee, select the commission ID that he is going to receive for the job... etc. Well as you can see the problem is that it is not letting me do it due to the fact that an entry is missing in the other table for that client or a client is not yet created for the sale. (Only one autonumber is assigned.)
What am I doing wrong?
Just in case you want to look at my mess... I have attached the DB :P
Hello, I have the following "range" table. I have a "txtBoxA" (numeric) and "txtBoxPrice". I have to look in the table for the corresponding range of "txtBoxA" and retrieve the VALUE for that range and store it in "txtBoxPrice"
LOW HIGH VALUE 1 500 40 501 1,000 70 1,001 2,500 90
Example: "txtBoxA" = 200 then the corresponding VALUE would be 40 and I would have to store 40 in "txtBoxPrice"
How would I do this?? I'm doing this in ACCESS Thank you
My school coursework database is on my memory stick, and i have just opened it, and all my forms, reports and marcos have gone. The file has gone from 12000kb to 10000kb, and a table MSysCompactError automatically created itself. How can i get it all back????? The last time i accessed the memory stick was on the school PC.