Modules & VBA :: Data Selection And Checkboxes
Sep 13, 2013
We have a small lab database where we insert the results of a water plant test. The results can be either Before treatment or After treatment.
And it can be treated numerous times a year.
I have created form with a drop-down box to select the customer and a button to show reports for the selected customer.
But I also want to add 2 check boxes: a Before treatment and After treatment box. And also add a date range.
So when selecting to view reports our users can select a date range example:
01/01/2013 to 01/10/2013 and a check box so users can select if the results to be displayed are Before or After treatment.
View Replies
ADVERTISEMENT
Apr 15, 2015
I have 8 checkboxes. Each checkbox has several e-mail addresses as string. Therefore, each checkbox has a string variable declared. I was wondering what should I do when selecting multiple check boxes. This is my code:
Code:
If Me!chkAGDLLA = True Then
Forms!email.lstName = Null
Forms!email.chkComercial = False
Forms!email.chkOperacional = False
strAGDLLA = "email1, email2, email3, email4"
strMail = strAGDLLA & ", " & strISA & ", " & strMAYA & ", " & strSANGER & "," & strSANSE & ", " & strSede & ", " & strGC & ", " & strCSR
MsgBox strMail
End If
Problem is that if I only select chkAGDLLA, then strMail will be "email1, email2, email3, email4, , , , , , ,"
I do not want all those commas, but how to make this work. I was thinking maybe a SELECT CASE so that strMail will accumulate data based on what's checked, but then there will be a problem of there being no comma between cases.
View 6 Replies
View Related
May 28, 2007
Hi! I've got a dousy for you all. I'm hoping that what I'm asking about is 1) possible, and 2) not very complicated.
I have a form that is based on a query that shows all records with a state field of say, New Mexico. I'm using this form to assign a campaign to all of the records that have a Yes in the Append? field of the record (which is populated by me when I run the query). So if there are 10,000 records that fit the state criteria, I don't want to append all of them. I'm wondering if there is a way to highlight (or some other method) them, and click the append checkbox ONCE instead of 5,000 times. I've got the code to select every checkbox, but I don't know how to write to code to only select a certain number of records.
If I have to, I could write an update query that asked for the number of records I wanted to have the append checkbox selected for, but that's a really long way around, and I'm hoping theres a simpler way. I'm sorry I wasn't very clear in my explanation. I hope you can understand and maybe help me figure this out. THANK YOU!
KellyJo
View 14 Replies
View Related
Aug 20, 2013
I have an unbound combobox on a form that is used to filter the records of a subform based on who they have been assigned to. The combo box is based off of a query to the personnel table and utilizes a UNION querry to add the option "**ALL**" with a id number "111111" as the first option in the combo box.
In other words: the combo box has a list of names to choose from and the word "ALL" at the top as the first selection. The idea is that when "**ALL**" is selected, the subform should display all records regardless of who they have been assigned to. I'm trying to accomplish this with VBA. I've started developing the code to try to impliment this, however currently when "**ALL**" is selected, I'm getting a datatype missmatch that seems to be caused by my use of recordset.
Option Compare Database
Option Explicit
Private Sub cboTaskListName_AfterUpdate()
'On Error GoTo cboTaskListName_AfterUpdate_Err
Me.Refresh
[code]...
Also once the queried records are saved into the record set, how can I communicate that to the subform so that it displays them?
View 2 Replies
View Related
May 2, 2014
I'm having a rough time finding information regarding filtering using multiple check boxes that are not part of an option group. I have 4 "sets" of check boxes that can each have multiple selections made.
For example I have:
12 check boxes for each month
6 check boxes for a selection of years
6 check boxes for order types
5 check boxes for order company
I have written code that successfully creates a string depending on what boxes are checked that looks like this.
[Ship month] = "1" OR [Ship month] = "2" OR [Ship month] = "5" AND [Ship Year] = "2013" OR [Ship Year] = "2014" AND [OrderType] = "SO" OR [OrderType] = "SM" AND [Order Company] = "10430" OR [Order Company] = "10440"
The problem is that it does not filter correctly. After playing around with it I found that as long as the entire is using all AND operators or all OR operaters it works fine, but as soon as I mix them it doesn't work.
View 4 Replies
View Related
Dec 17, 2013
I'm trying to write some simple code to see whether two check boxes (named cbM001 and cbM011) have been checked and if so, then send out an error message. So far I have tried:
If cbM001 Is False And cbM011 Is True Then
MsgBox "M011 cannot be selected unless M001has also been chosen."
Exit Sub
[Code].....
With this I get "Run-time error 424: object require"
View 6 Replies
View Related
May 12, 2015
Okay I have a Private Sub on form PlotF:
Code:
Private Sub SetCheck212()
If Me.[Check161] And Me.[Check169] And _
Me.[Check167] And Me.[Check181] And _
Me.[Check261] And Me.[Check189] And _
Me.[Check187] And Me.[Check195] And _
Me.[Check203] And Me.[Check201] Then
Me.Check212 = True
[Code] .....
Some of the checkboxes are locked as I want to force the user to check them on another form (InvoicedF) but I want them to be displayed PlotF as well.
So I want to call the Private Sub from another form. So that the Check212 still automatically checks to true with out PlotF open on the screen.
Is this possible, Do I have to make this private sub a public sub? If so how do I do this?
View 8 Replies
View Related
May 5, 2015
I have a table tblMessages, with a yes/no column called Available I have a form with three checkboxes chk1, chk2, and chk3 the when i click chk1 the other two check should be checked which this code seems to do but what it is not doing is going to the table and selecting the data where the ID is 2. what am i missing here?
Private Sub chk1_Click()
Dim strSQL As String 'Holds the SQL statement for this command only.
If chk1 = True Then
chk2 = True
chk3 = True
strSQL = "UPDATE'[Available]' FROM 'tblMessages' WHERE '[ID]'= 2"
Else
chk2 = False
chk3 = False
strSQL = "UPDATE '[Available]' FROM 'tblMessages' WHERE '[ID]'=2"
End If
Me.Requery
End Sub
View 4 Replies
View Related
Jun 28, 2014
I have a Form with a combobox and 3 checkboxes now i want to change the Rowsource of the Combobox by clicking on the checkboxes. When i click the Checkbox the Rowsource gets Changed as i want it but i can not use the new Values cause its giving me the error "The value you entered is not valid for this field"
The Funny thing is its always bound to the type of data i choose first. When i first select the Week i can select only Weeks (17,18,19 etc)
When i choose Day first it only accepts Dates (01.01.2014 etc)There is no Control Source set . And the Bound Column for all Sources is 1
Here the Code
DD_Zeitraum is the Combobox
CB_Day CB_Week CB_Month are the Checkboxes
Code:
Private Sub CB_Day_Click()
If Me.CB_Day.Value = -1 Then
Me.CB_Month = 0
Me.CB_Week = 0
Me.DD_Zeitraum = ""
Me.DD_Zeitraum.RowSource = ""
Me.DD_Zeitraum.RowSource = Dist_Datum
Else
Me.CB_Day.Value = -1
End If
End Sub
[code]...
View 10 Replies
View Related
Nov 29, 2013
I have a field 'Payment Types' with values (Cash, Cheque, Debit/Credit Card) and a field 'Payment Received' which is Yes/No.
When putting the order through the user selects the payment type and ticks a box if payment has been received.
On a report for delivery drivers, the owner wants it simple for the driver... he wants all the payment types listed with a checkbox next to each one, then wants the appropriate box ticked if payment has been received.
So I need something on the report (or underlying query) which ticks the appropriate box, i.e.
If payment received = true then payment type checkbox = true.
Or should I put the payments into a separate table with both fields so multiple payment types can be marked as paid?
View 6 Replies
View Related
Jun 1, 2015
I'm on my way on creating a simple Database for a company. This database contains several tables, one of the tables will record information about the training that had been completed by each employee. There are about ten sections of training that should be completed.
For instance, I have two tables called 'Development' and 'CSA_Lisence'. 'Development' is the table that record the information about training which containing ten checkboxes (which represent ten sections of training) and CSA_Lisence will be automatically requeried when all of the checkboxes on Development are fully checked.
Here's the step I've been worked on :
First, I made a function called 'CheckCompletion' to ensure whether all the checkboxes are checked :
Code:
Public Function CheckCompletion() As Boolean
Dim blnComplete As Boolean
Dim strCompletionSummary As String
strCompletionSummary = Basic_Inspection & Certifying_Staff & Safety_Management_System & Regulation_Part_145 & Part_M & EWIS & Fuel_Tank_Safety_Level_2 & Dangerous_Goods & Human_Factor & Basic_Supervisory_Training
[Code] ....
Second, I made a function called 'UpdateEmployee' to handles if all boxes are checked :
Code:
Public Function UpdateEmployee()
Dim emp_numb As Long
Dim emp_name As Long
Dim strsql As String
emp_numb = [Forms]![development].[employee_number].Value
[Code] ....
Then, I put this code on every checkbox's after update event (example only) :
Code:
Private Sub Basic_Inspection_AfterUpdate()
Call UpdateEmployee
End Sub
The problem is, nothing happened with the tables. However, when I managed to remove the 'If checkCompletion' condition, it worked and the 'CSA_Lisence' is requeried, but I will have ten multiple records with same contents (I just need one record per employee). I guess there's something wrong or missed in my code. Or i need to remove something?
View 7 Replies
View Related
Dec 18, 2014
I am trying to save specific data from a data entry form to a specific depending on what the user selects from a dropdown/combo box.
So if the user selects "test company from the combo box, that data (from that form) will save to the Test company data table.
View 5 Replies
View Related
Apr 6, 2014
I have a form where I add a new event, and it gets added to a list box in another form, I was intending to select the most up-to-date record within the list box but it seems to keep selecting the old latest record and not the new record that ive added. I had tried to select the first record but then move to the last record hoping it would refresh but that still doesn't work.
This is the code I used below:-
Quote:
'Select last event record added to event list box
Me.lstPatientEvents = Me.lstPatientEvents.ItemData(Me.lstPatientEvents.L istCount - 1)
lstPatientEvents.Selected(lstPatientEvents.ListCou nt - 1) = True
View 1 Replies
View Related
Dec 18, 2006
Hi all
I would like to find out if there is a program where you can randomly select data out of a table?
I sit with a table with 17000 SKU's(codes and data) and need to randomly select items out of it for Stock Count's:confused:
Thanx:rolleyes:
View 6 Replies
View Related
Jun 11, 2013
I have a table with several fields including the following 3 fields:
dtmAppoint Date = stores appointment date
dtmAppointTime = stores appointment time
lngAppointDoctorID = stores doctor's id for specific appointment
When I enter a new appointment, I want to know whether a specific combination of these 3 fields already exists. The doctor is actually a dentist and maybe another appointment has already been placed for the same dentist on a different chair. Creating a recordset as indicated below works but I am having some problems with comparing Time (dtmAppointTime). The following works but I need to extract Hour, Minute and Second and put it into string variable strTimeDum.
Code:
rstSearch.Open "SELECT * FROM tblAppointment " _
& " WHERE (clng(dtmAppointDate) = " & CLng(rst!dtmAppointDate) & " )" _
& " AND (dtmAppointTime = #" & strTimeDum & "#)" _
& " AND (lngAppointDoctorID = " & lngAppointDoctorID & ");", CurrentProject.connection, adOpenKeyset, adLockPessimistic
Any way to retrieve the records that correspond to the specific time or a simpler way to access the records of interest?
View 10 Replies
View Related
Oct 18, 2013
I have a form that allows me to change the information for a list of personnel. On this form I have a list box that displays all the personnel in the list. There should never be more than 12-15 people in this list so it's an effective way of selecting records, however I can't figure out how to make the form select the record that is tied to that person from the list.
In VBA I've tried creating an "On Click" command for the list that, when a name is selected, is brings up the corresponding record. I thought I could use a DoCmd.FindRecord but I guess I don't quite know what I'm doing. I didn't want to use SQL to limit the records to just the one that matched I wanted to keep it simple if possible.
Code:
Private Sub Personnel_List_Click()
DoCmd.FindRecord Personnel_List, , True, , True
End Sub
The Personnel_List box is tied to the Personnel_Table, and the table only displays the names available.
View 3 Replies
View Related
Jun 27, 2014
I have a form with a field called duration.
The user selects AM,PM or All Day from a list
If the user chooses All Day I want to create a duplicate record
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdCopy
DoCmd.RunCommand acCmdRecordsGoToNew
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdPaste
However I would like the duration in the first record to be AM and the Second record to be PM
So something like Iif [Duration], "All Day" run procedure.
Else IIF do nothing.
View 2 Replies
View Related
Jan 31, 2014
I would like to be able to clear a combobox selection with code but nothing I have tried is working.
Most recently I have tried this:
Code:
Me.cboCompanies.ListIndex = -1
To no avail. The selection still remains highlighted in the control after the code is executed. I want the control to be blank. Also the control goes from being a combo box to a text box until escape is pressed and it is cleared
I have also tried using a simple Undo and that is not working either.
View 8 Replies
View Related
Mar 25, 2015
I have 1 combo box contains 2 columns look-up directly from the properties(Not VBA)
Now i want to select record from the list
Example: i want to select PM-1234-1111 so i dont want to type starting letter PM to select but i want to type 234 or 123 or somewhere in the middle or end to filter that contained text in all the items is it possible?
Any Property settings or any VBA code?
View 1 Replies
View Related
Dec 11, 2014
I am using access 2010
I am trying to get my list box to filter based on the selection of a combo box.
My Combo box cboOrgRole is on my main form and is bound to OrgRoleID - on form - frmOrgEntry
The unbound list box lstRoleList is in a tabbed subform - frmPersonnel
This is my data pull for lstRoleList
Code:
SELECT tbl00PersonRole.PersonRole, tbl01Orgs.OrgRoleID
FROM tbl00PersonRole INNER JOIN tbl01Orgs ON tbl00PersonRole.OrgRoleID = tbl01Orgs.OrgRoleID
WHERE (((tbl01Orgs.OrgRoleID)=[Forms]![frmOrgEntry]![OrgRoleID]));
This is the code I have on cboOrgRole AfterUpdate
Private Sub cboOrgRole_AfterUpdate()
Me.frmPersonnel.lstRoleList.Requery
End Sub
I have also tried Recalc - both throw a Compile error: Method or data member not found
My goal is to be able to select the role of the organization, (General Contractor, Architect, Engineer, or Client) and have it list the available titles for the specific organization type.
My "00" tables are library tables
View 12 Replies
View Related
Jul 31, 2014
I'm trying to write a query to allow the user to search through records.
To make the interface simple I just want a combobox to select the search field and a text box to enter the search string.
My problem is trying to build a query where the value of a combobox on a form is used as a field in the query.
View 3 Replies
View Related
Mar 1, 2005
I'm trying to filter my table so that i can make it a query. The data in the Facility is linked to another table with FacName and FacID. When i try to filter the data to create the query from the table, it says type mismatch. It's really bothersome....btw is there another way to create a filtered query?
View 2 Replies
View Related
May 16, 2013
I have a form that has a combo box in the header. I want to be able to select an employee name and the remaining info in the detail section of the form populate. My other fields are:
Employee Name - text box
Reporting Unit - combo box
Department - combox box
Primary Phone - text box
Secondary Phone - text box
Emergency Contact Name - text box
Relationship - text box
Emergency Contact Primary Phone - text box
Emergency Contact Secondary Phone - text box
B-Alert Txt - combo box
B-Alrt Phone - combo box
e-mail - text box
View 6 Replies
View Related
Nov 29, 2014
I am trying to generate an email that will send a copy of the last record entered from my table "Main" to a departement email, based on the department field entry on my form.
I know that I can send emails both thru outlook as well as direct. Would prefer to sent the direct (without opening outlook). Here is what I'm working with:Table with record informaiton called "Main"
Form called "Action Entry" which contains the information that I would like to send- part of which is a feild called "Assigned To" which is a list of departemnts linked to a secondary table called "departments"
Table called " departments" which contains the following Fields: ID, Departments, Email.What I would like to happen is when I hit the exit button on my form, an email goes out to the "Assigned Department" email address associated to the select departmet, that shows the information in the form (which i expect will be a report saved as PDF). I understand some of the VB code to create an email, but don't knwo how to tell it to select the correct email based on the Department selected on the form.
View 5 Replies
View Related
Jan 12, 2015
My table has a yes/no field and about 10 records. I have created a form for the user to select which of the records he wishes to use - the records are displayed in a continuous form with a check box for the yes/no field. The user is to select one record by checking the check box in the record.
I know this should be obvious, but I can't see it. How can I make it so the user can only select one of the records (when he clicks on one, that one is yes and the others revert to no?
View 4 Replies
View Related
Mar 7, 2014
Is it possible, within an OnOpen even of a specific report, to set the printer selection and page setup (size, margins, etc.) to certain things? If so, how would I go about accomplishing this?
I would like to do this for specific users within our domain (this I won't have any trouble with).
View 9 Replies
View Related