Modules & VBA :: If Combo Value Changed Make Checkbox True
Feb 20, 2014
I have combo box call "supervisor" and check box call "supervisorchange" basically want to make supervisor change to true if combo box is change which I have made code you can see below it work's
Code:
Private Sub Supervisor_Change()
If Me.Supervisor = "" Then
Me.SupervisorChange = False
Else
Me.SupervisorChange = True
End If
End Sub
right now my problem, prob easy fix for you access experts
If the supervisor combo box is empty and user inputs a supervisor I would like the supervisor change check box not to change to true
only if the user changes it after the first input I would like the supervisor change check box to become true
When you update inspection requested the inspection due is automatically updated to 30 work days from that day.
Now what I'm trying to do is get the overdue field (it's a yes/no field) to automatically check itself when the current date is passed the inspection due and the inspection done field is blank.
Here's what I have that isn't working:
Code: Private Sub Form_Current() If DateAddW([REQUEST], 30) < Date And [INSPECT DONE] = 0 Then [OVERDUE] = True End If End Sub
DateAddW is a UDF that works just fine. I've tried replacing 0 with Null and neither works.
Hi, in my web page, i would like to user to see a ticked checkbox should the database = True however, i cannot seems to be getting it. Would anybody be able to help me out?
strSQL = "SELECT DeptHeadA FROM Employee WHERE EmpId = '" & strEmpId & "'" nRecDHA = GetRecordset(strSQL, arrDHA)
if arrDHA(0,i) = True then arrDHA(0,i) = "Checked" else arrDHA(0,i) = "" end if
I have a query that uses a checkbox from a form as a criteria. in the table the values are stored as 0,-1. if i run the query with the checkbox false, the query works and filters correctly, same if the box is null. But when I check the box true, no records load. It worked in an older version of my database so i am not sure why when i copied it over it doesn't work. I even tried a combo box with values of 0, -1 and got the same results.....
I have a form where the user selects check boxes to choose what fields to include in a report. Because of the massive amount of data, I need to send it to a temp table and then on to Excel and not use a query.
I have this line of code, for the insert into temptables for other forms that don't require the yes/no box and it works very well, but I can't figure out how to do it with these yes/no conditions.
This is the execute line that inserts into the TempTable for the other forms:
How would I write: If Check1=True Then INSERT INTO TempPicktbl Field1 If Check 2=True Then INSERT INTO TempPicktbl Field2 If Check 3=True Then INSERT INTO TempPicktbl Field 3 etc.
I'm pretty sure it's the INSERT level where I need to put this code.
Hey all, i got another small problem with this bloody database!
The problem today folks is this, im making a booking system (well the booking is a small part of the overall system) so i have DateArrive, RoomID, and all the usual.
now what i want is to make a query that says if DateArrive & RoomID (Booking Table) then make RoomOccupied(Room Table) true
if that makes sense, i tried some in sql and got the date bit working, but wasn't sure how to go further so as to make it so RoomID is involved
(ill say in another way If a room is booked on a specific day i want to make Occupied true)
i have a form that shows payments (checks) that have been issued. sometimes those checks need to be voided and i want 2 fields (Updated By and Updated Date) to pop up when the payment distribution field is changed to a void status.
payment distribution: "I" for issued and "V" for void
i've gotten the On Change Event to work with VBA when the payment distribution changes from "I" to "V" and the 2 new fields pop up but if i exit the form and go back in to look at that record, the fields are gone. Is there a way to make the fields permanently if the payment is "V" on the form?
this is what i have so far for the On Change Event:
If [payment distribution] = "V" Then me.cmbo_UpdatedBy = True me.txt_UpdatedDate = True Else me.cmbo_UpdatedBy = False me.txt_UpdatedDate = False End If End Sub
I have a form that shows the records found in a query if the completed tick box is false. this is fine, but i have also put the tick box on the form, and wish the user to tick it when they are done how ever they, get a beeping error and wont let you change it to true. Can anyone suggest the resolutoin for this.
My database will be creating quotes based on employees entries. Each quote will be unique because of the part. Each part has the potential to have Precious Metals, and Base Metals included. The employee must select the number Precious Metals and Base Metals that a particular part has. The problem lies with what happens after this selection is made. There are three fields that need to be defined pertaining to each metal. I need the number selected to determine how many fields to make available. If there are two precious metals, I need to make the three fields available twice; one for both metals. I have the possibility for up to 5 Precious Metals and 10 Base Metals per part. How can I make the selection from a combo box populate that number of Metals Fields?
I want to add a textbox to my forms that either says "Yes" or "No" depending on what a non-visible checkbox is. My forms look funny with checkboxes all over the place (Yes or No fields). My reports would look better with "Yes" and "No" rather than checkboxes.
The question is, the control source of the new unbounded textboxes (or anything else for the matter), I don't know how to write the expression for it.
Can I just say...
if checkbox1=true then txtbox1="Yes"
I understand how to write these in the VBA builder. But in the expression builder...
I understand the problems that can be brought upon ones self by creating the table with lookup fields, But if the table was orginally designed with them and then the Field is then changed to a Text box instead of a Combo box will the inherent problems associated with the lookup within a table disappear?
I have a colleague who executes a make-table query that reads a txt file. While doind this, he wants to convert two columns (binary format) to checkboxes (Yes/No format). Is there a way to do that?
I have a form with a Yes/No checkbox. Sometimes a data entry person will use this, sometimes an associated report is printed and a technician in the field will be required to fill check the box by hand and return the report for data entry. what I have tried to format the check box, if the box isn't already checked, I can't get it to show up clearly on the printed report. It's set to Visible, width 6pt, solid, black, always display, yet it still is barely visible. Ive tried increasing the grid line thicknesses, making it shadowed, nothing seems to work. Is there anything I can do?
I am using Access 2010 and I have my tables hidden in the navigation pane (I don't have any concerns about users finding the tables to make edits), however I am looking to "lock" all fields on a form once a user saves the record. The concern is that when they go to enter a new record they may end up on a previous record and overwrite the information. My thought was to create a checkbox on the table that I can edit each week to lock records. At that point, what type of code can I create or use that will lock records on the form?
I have come across a weird event from the 1st July.
I have a form that inputs dates into the table.......nothing special.......
Form is totally unbound and the insertion to the table is done via DoCmd.RunSQL Insert every thing has been fine until the 1st of July at this point it started saving the date into the table in American format 07/02/2013 instead of UK 02/07/2013 There have been no changes to the database at all to give me a reason why this has happened.
The Table fields are set to Date Fields.
The SQL Insert was set to Date ( #" & DATE & "# )
The date displayed on the form is in the correct format to get around this I have set the insert of the date as a string ( '" & DATE & "' ) AND how can i reformat the dates that are incorrectly inserted to the correct format as they include the date and time 07/02/2012 11:11:47
There is about 1000 lines so manual change will be a nightmare.
I have a table which has 2 fields 1) Project_Priority_Number and 2) Previous_Priority_Number. If there were 100 records these would be numbered 1-100 in the order that the user originally sets the priority (this number is in addition to the record ID number). I have created a form with code that moves the Project_Priority_Number to the Previous_Priority_Number and then shows the Project_Priority_Number as blank and displays all of the records.
The user can then set new priority numbers in the blank column. Say they choose to make the old priority number 4 the new number 3 and priority 27 now becomes say 2, etc. I want the user to press a button that re-numbers the remaining ones based on their old position + or - 1 (basically to fill the gaps but based on their previous positions). I understand how to renumber if one is deleted but I don't know how to be more specific and re-number based both on their previous priority number and whether something else is now set to replace that.
For Example (the following numbers need to re-order based on previous priority 4 becomming the new priority 1 and the previous number 8 becomming 3 - so the previous 1 becomes 2 and then everything after the new 3 moves forward 1):
PROJECT PRIORITY NUMBER PREVIOUS PRIORITY NUMBER 1 2 3 1 4 5 6 7 3 8 9 10
On a form (default view: Single), I have a bunch of bound controls that display one record at a time from tblMain. I have a bunch of unbound controls as well (buttons).
If the user tabs through all the controls, reaches the last one (btnLast), and presses tab again, the focus is set to the first control (btnFirst) and the bound controls change to display the next record. I just want the focus to be set to the first control without the displayed record being changed.So I set up an "If" statement in Private Sub btnFirst_GotFocus()
Code:
If Screen.PreviousControl.Name = "btnLast" Then [code to change record back to previous record] End If
But btnFirst gets the focus when the form opens, so Screen.PreviousControl spits out an error.I've accommodated this like so:
Code:
On Error GoTo ErrorHandler If Screen.PreviousControl.Name = "btnLast" Then [code to change record back to previous record] End If Exit Sub ErrorHandler: Exit Sub
There are around 100,000 records to update. Would a SQL Statement be more efficient?
It is a local table being used to sum up the results of a handful of rules. The columns can only hold True or False (datatype) If and only if all columns are True - then true
MyRow T T T T T T T T T T - Sum in next column is T MyRow T T T T T T F T T T - Sum in next column is F
Speed is very important. The Recordset for a single row is still open on the Currrent Record since the Update just finished.
Code: RS_RE_1SegStatusProfiled.Fields("Total") = (RS_RE_1SegStatusProfiled.Fields("RE_1") AND CStr(RS_RE_1SegStatusProfiled.Fields("RE_2") AND (RS_RE_1SegStatusProfiled.Fields("RE_3") ' and so on
My guess is that since the recordset is open to the current record on a local table, it will be efficient to just re-read all of the values and And them together.
Since I have code writing to each record, I could also go through all the extra assignment of a local variable.