Modules & VBA :: Changing To A Record Based On Text Box Entry
Sep 16, 2013
i have a database with a large number of records. Navigating through the records through a form one by one is a pain, so i want to create a text box where you can enter the ID number of the record, and whichever record has the matching ID number it changes to that specific record. I know that something like this is already apparent at the bottom of Access, but i want my user to do everything within the database itself, as all of the panes are removed whilst being used
I need help with an update query that will change records for me based on the date
In the record I have a TEXT record called [GI1] that can have a multitude of data in it. The data can be “EVA”, “CON 10/12/06”, “REQ 10/12/06”, “PAS 10/12/06”, or “B 10/12/06”, and finally “A 10/12/06”
What I need is a query will look at the Data that starts with “B” and change the letter to “A” if the date in the record has passed. {The Date can be any date in any year }
Hello, Could some kind person out there help me out please? I have been 'dabbling in' the area of conditional formatting, particularly in the area of changing the colour of my active form based on the result of what’s output on a text box. I have had some success in this area but where I am getting confused is getting the colour of my form to change on the basis of what is entered into a text box control that does not match exactly. My forms background changes to the required colour when its value is ‘set exactly’ but what I am trying to achieve is to change it according to the first letter of entry regardless of what follows? It always starts with a letter, either a ‘D’ or ‘V’ to indicate whether its ‘Vital’ or ‘Desirable’ and is subsequently followed by no more than 6 numbers and finally a letter. Basically I need my form to change colour based on the whether it is either a ‘V’ or a ‘D’ irrespective of what follows???
What I have been using so far is:
Private Sub Model_Number_AfterUpdate() If Me.Part_Number = "V111145K" Then Me.Section(acDetail).BackColor = 12632256 'Light Red Else Me.Section(acDetail).BackColor = 8421631 'Blah Gray End If End Sub
Private Sub Form_Current() If Me.Part_Number = "V111145K" Then Me.Section(acDetail).BackColor = 12632256 'Light Red Else Me.Section(acDetail).BackColor = 8421631 'Blah Gray End If End Sub
I'm this is a simple issue. I have a combo box which can have the following status's: Not Started, In Progress, Complete. Depending on the value of the combo box i want a different image to show. So if not started is selected i want the user to see a red box. If Complete is chosen, a green box will show. i can do this easily enough but my problem comes in when i go to the next record. The boxes just stay visible regardless of what option is displayed. What event is triggered when you go to the next form?? Form Open / Load doesnt seem to work. :mad: :confused:
I am rebuilding a file that deals with a lot of active and inactive accounts. I would like to change the inactive record to a yellow or red when a check box is marked. It has been about 15 years since I have written any macros or VB functions.
I want to be able to pre-fill records with information based on a form every day for each client. This needs to display in a datasheet view showing all clients for each location.
Each day the subform needs to show the expected results of that day's activity with clients if all default conditions are met. (i.e. client receives a call that day based on expected conditions calculated in a form for that day).
I am having a query which having a category field like Electrical, Sports, House hold etc.
What I want that if i select Electrical then it should return 15, if Sports then 10 and so on i think this could be done through this below mentioned VBA but it need change from integer to text...
Option Compare Database
Public Function fncGrade(intNum%) As String Select Case intNum Case 0 To 1: fncGrade = "Same as Previous" Case 2 To 32: fncGrade = "C-3" Case 33 To 40: fncGrade = "C-2" Case 41 To 50: fncGrade = "C-1" Case 51 To 60: fncGrade = "B-3" Case 61 To 70: fncGrade = "B-2" Case 71 To 80: fncGrade = "B-1" Case 81 To 90: fncGrade = "A-2" Case 91 To 100: fncGrade = "A-1" Case Else:: fncGrade = "X-X" End Select End Function
I have a form where customer data is entered. one field serves as a criteria for a query. If, for example, A is selected in the form the query uses the criteria "A" in the X field f query. However, if B is selected in the form, the query uses the criteria "B" in Y field of query.
I can easily do this by setting up two queries and having criteria A run in X field of query and similarly for B. However, it seems as if there should be a way for me to have one query and simply use the criteria in a different field.So, is there VBA that will update a given query's SQL to use one criteria in one case and another critiera in another case?
Is there a way to duplicate, triplicate, a record based on an option group selection. i.e.
Form Field: Option group Value = 1 Value = 2 Value = 3 Field 2: Field 3: Field 4: and so on.
Basically if value 1 is selected, then I fill out the rest of the fields hit enter and go to a new record. But if value 2 or 3 is selected, I fill out the the fields, hit enter. The information is recorded said number of times based on the selection in the option group. Ideally I would have2 or 3 of the same record in the db, with different Primary keys of course.
I need any code or way that whenever any field of a record according to unique ID changed the code must save the changed field name and the current date in a specific field in another table (first field store the ID and the second one detail about changes) with add record mechanism. Suppose I have a table about the information of students with the name std_info and another info_report and when any changes make to the any field of std_info the field number and the unique ID to the table info_report. I want to use this system to record which user make changes to which records.
I have a form that opens up and fills in all of the Orders Table when it opens.
I then have a subform that is used to fill in the order details.
Currently if they open the form and then close it, it creates a record in the order table. I want to be able to delete this record if no information has been filled into the subform?
I have a database that makes use of standing orders. That means that if a client has a standing order to receive products during for example 4 time as year (quartely at the end of the month). to automate the new entry by copying an old entry in the database.
Let's say I have a client where we will have to send a product at the end of June, it will look at a field where the next send date is, and when it reaches 2 weeks for that date, to create a new entry in the database based on that entry. This way, it will pop-up in our open cases and we are aware of it and also will be visible in our report.
We have a table, JobRegister that people enter information on using a form, FrmOrderEntry
I would like to run a check when a serial number is entered in the field SerialNo to see if the same serial number exists where CompletionDate is null.
this would stop duplicate open orders being put on the system, or new orders being entered where the previous order hasn't been completed.
I'm changing a record source on a form when the user clicks a "save" button.
I'm doing this to store a value from the current form in a table that is not part of the default form query.
This works fine.
I have a separate button on my form called "Home", when the user clicks this button it requerys the current form which triggers the before update event to run, this in turn brings up a message box which asks the user if they want to save or not. If they click yes then it runs the SaveButton click() code.
For some reason when the user presses the save button and then exits, everything works but if a user presses the “home” button which triggers the save button then it brings up the “2107 The Value you entered doesn’t meet the validation rule defined for the field or control.” Runtime error and stops on the change recordsource command.
Why triggering the same code directly from a button or indirectly from a before update event has two different outcomes.
I've got a data entry form bound to one table. The form has four buttons:
- Clear Fields - Cancel - Save and exit - Save and add another (which should save the user input to the subform/table, clear the input fields, and allow the user to add another record)
I can't quite seem to get the "Save and add another" button to work. When I put some information in the input fields and click the button, it saves it to the subform/table perfectly, but when I try to do it again, it just edits the last record (the one just created).
How can I get that button to place the information from the input fields in a new record every time?
The _Click event for the button looks like this:
Code: If Len(Me.field1 & Me.field2 & Me.field3) > 0 Then Me.Refresh btnClear_Click DoCmd.Save End If
I have a form for entry and some fields are computed or result of a query from another table. I have a function that looks up a value from another table like so
************************************************** ******** Public Function GetTargetType() As Variant GetTargetType = DLookup("type", "tblFormulations", "[tblFormulations!formulation]=Forms![frmNmsConsumptionEntry]![formulation]") End Function ************************************************** ********
Which works fine when I test in the immediate window.Then I have this form event. This however does not insert this value when I am adding records using my continuous form.
************************************************** ******** Private Sub Form_BeforeInsert(Cancel As Integer) Me!target_group = GetTargetType() 'Forms!frmNmsConsumptionEntry!target_group = GetTargetType() '[tblNmsConsumption.target_group] = GetTargetType() End Sub ************************************************** ********
making sure I can insert this value once retrieved.
We have a navigation page with 5 tabs and several navigation buttons underneath their respective tabs linking to reports.
In the main part of the navigation page we have 17 search parameters (text boxes and combo boxes)that the user can use to sort through all the reports we have in the different tabs.
What we would like to do is to have the label text to change to "red" if one of the 17 fields are "required", remain "black" if it is included in the report but not a mandatory search parameter, or turn "light grey" if that parameter is not included in that report.
For example:
My search parameters are: people, phone, and cars
If I were looking at a report of people that included addresses, phones, etc...name and phone would be required search parameters. However, even though I can search by car, it is not in this particular report and the label text should be greyed out. (If the actual text box could go inactive that would be even better).
I have read about buttons being turned colors based on a drop down box choice, but I have not been able to find anything about using a navigation tab subform button to make the colors change in the main navigation form.
I have the main form open up where the Data entry is set to YES so it opens in New Field. I created a button to change the value of form's Data Entry to NO. It works. Changed the form so I can navigate through entered fields. I have created a drop down to filter a specific field "Claim#" and it will open that entry.
The drop down only works if I set the default form's Data Entry to NO. Dropdown works and I can select Claim#. But if I open the form with DataEntry set to Yes, and I click on the button to change the value to NO, the form changes but the drop down field does not pull up the proper information. The button code is.
Private Sub EditButton_Click() Form_MainForm.Form.DataEntry = False End Sub
The Claim drop down has this event after update
Private Sub ClaimSearch_AfterUpdate() Me.Requery End Sub
I'm missing something. Like I said, it works without having the button change the value.
I am using MS Access 2007 and have a report which display the list of values (say 10 fields) from the basic SELECT * FROM table query.
I need to dynamically set the BOLD based on the particular value for the fifth field which was assigned from Query. if it doesn't match it should display normal.
E.g If Field_5 = "Agent" then Field_5.FontBold = True Else Field_5.FontBold = False End if
I tried the aforementioned code and it dont work. ALso i tried achieve it using below listed options.
I have the code below and am trying to have a form allow Text Box to become visible based on selected items from a List box. Why I am getting the error listed?
Compile Error: Invalid Qualifier
Code: Private Sub specific_opt_Click() Dim users As Control Dim ctrler As String Dim xx As Long If Me.specific_opt = True Then GoTo 169
Table name: Items Field: ItemName Form name: Frmpayments
when I open the above form, it should create texts boxes on "frmpayments" based on how many data available in "Items" table under "Itemname" field. It'll be even better, if it can put those item's name in each text box it creates.
I have a lengthy CASE statement in my database that displays specific text in a field based on the value of another. Simple stuff but for some reason it randomly will not work on certain values, and never the same one twice. Is there a commonly known cause for this? I have verified that the spelling and spacing etc. are correct in my code so that shouldn't be causing the problem.