Modules & VBA :: Multiple Check For Value
Feb 4, 2014I have value in the form call (welder) & based on the other data i will enter in form i need VBA to check if this welder is certified to do the job or not.
View RepliesI have value in the form call (welder) & based on the other data i will enter in form i need VBA to check if this welder is certified to do the job or not.
View RepliesWhen UseDDelivery is checked the three textboxes should be disable and when the form is opened UseDDelivery is set to be checked by default so the textboxes should be disabled when the form opens but they aren't. the two different ways of doing it are shown below.
Elements specific to my system :UseDDelivery = checkbox
AltDeliveryAddress = textbox1
AltDeliveryTown = textbox 2
AltdeliveryPostcode = textbox3
Solution 1:
Code:
Me.AltDeliveryAddress.Enabled = UseDDelivery.Value
Me.AltDeliveryTown.Enabled = UseDDelivery.Value
Me.AltDeliveryPostcode.Enabled = UseDDelivery.Value
This is a bit of vba a friend wrote for me quickly, it includes all three textboxes but the checkbox enables them instead of disables.
solution 2:
Code:
Private Sub UseDDelivery_AfterUpdate()
If AltDeliveryAddress.Enabled = True Then
AltDeliveryAddress.Enabled = False
Else
AltDeliveryAddress.Enabled = True
End If
End Sub
With this bit of vba I found the checkbox enables the textbox instead of disabling it and I can't figure out how to include the other two textboxes
I am making an asset table which amongst other fields have fields for "serialNo" and "Manufacturer"
I am trying to write some code that after update of manufacturer in the form, will check to see if that serialNo and Manufacturer exist.
ive managed to do it for one value, using
If Not IsNull(DLookup("[serialno]", "Assets", "[serialno] = '" & Me!serialno & "'")) Then
msgbox "blah blah"
which works great, but am struggling when i'm asking it to lookup two values.
I have run into an issue with a basic DLookup. The database has grown in size and now we could have multiple entries, but I want it to return a certain one. So the information could be in it three times. Of course DLookup stops after the first one. How do I get it to loop to check the entire table? Someone mentioned to me to use a recordset, but how to write that as I have never used it before. Below is what I was using until this new request came up.
<code>
Private Sub txtloan1_AfterUpdate()
If IsNull(DLookup("[loan1]", _
"settlement", _
"[loan1]=""" & Me.txtloan1.Text & """ AND [status] = 'Open'")) = False Then
Cancel = True
MsgBox "Test", vbOKOnly, "Warning"
End If
End Sub
</code>
This was also executing after the user entered the information within a text field. I did not want them to enter all the data and then have it come back as a duplicate.
I am using the following code to check for duplicate tickets when importing multiple records into a datasheet view form by using the paste append function.
Code:
Private Sub Ticket_Number_BeforeUpdate(Cancel As Integer)
DoCmd.SetWarnings False
If DLookup("Ticket_Number", "Record_Store", "Ticket_Number= '" & Me.Ticket_Number.Value & "'") > 0 Then
Cancel = True
MsgBox "There were import errors, please open View Import Errors above."
End If
End Sub
The form is used to insert multiple records into the database at a single time.
That codes works to check for duplicates. And if there are none there are no popup messages.
If there are duplicates though it gives a popup for every single Ticket_Number that is a duplicate.
I am wondering if there is a way for it to give only a single popup once it completes checking all the records to be imported for duplicates.
Private Sub Form_Current()
If Me!pairport Then
Me!pterminal.Enabled = True
Else
Me!pterminal.Enabled = False
End If
If Me!dairport Then
Me!dterminal.Enabled = True
Else
Me!dterminal.Enabled = False
End If
End Sub
Private Sub pairport_AfterUpdate()
If Me!pairport Then
Me!pterminal.Enabled = True
Else
Me!pterminal.Enabled = False
End If
End Sub
Private Sub dairport_AfterUpdate()
If Me!dairport Then
Me!dterminal.Enabled = True
Else
Me!dterminal.Enabled = False
End If
End Sub
ok i am trying to make this rule apply for the destination part aswell, which is dterminal and dairport
gettin this problem
runtime error 438
object doesnt support property or method
All,
I have a problem building a query using multiple check boxes. The situation is as follows:
I have a database to monitor enquiries which come into a central email account. I have devised a system where several check boxes are used to define the nature of the enquiry. Users can tick any number or none of the options to describe the enquiry.
I would like to create a query where users can search the database based on the check boxes which have been ticked. For example, if users want to search for enquiries where a specific three check boxes have been ticked, I would like all of the records where these three boxes are checked to appear, and so on for all different combinations of check boxes ticked.
I've tried a few methods, including creating a seperate form for the query where users check their search criteria in line with the enquiry form, but I can't link this with the original form.
I hope my description adequetly conveys the problem I have!
Any thoughts would be most welcome.
Rob
:confused:
Hi there,
I have several check boxes, that are however categorised, in my form. I was now wondering, in order to save some time, how could I make a check box that marks/unmarks all the boxes under that specific category ??
Cheers,
Pekka
I am using a yes/no field to select a number of records for a report. Is it possible to deselect and turn them all back to no at one time when finished with the report. It would be nice if I did not need to deselect all of them individually.
View 3 Replies View Relatedi am very new to access and even vba. I have a form called FrmAgent. Here there are 5 check boxes [CheckBob] [CheckJim] [CheckNikita] [CheckNoe] [CheckKyle]. I have one button named "RecieveData". I have one table named "Agent" and a query called "QryAgent". in the same column there are five people Bob Jim Nikita Noe and kyle. What i need is to have the button when its clicked run my query to produce the data. However, if multiple boxs are checked i need the data for those people. As of right now if i click the button (doesnt matter how many boxs are checked) it gives me data for all five people. Is there a way i can do this where i can receive the data only for the people that their boxs are marked?
View 2 Replies View RelatedI have a table(Product Change) with these fields:
Tracking Number
Approved (a check box)
Engineering (text box that represents department)
Purchasing (text box that represents department)
Quality (text box that represents department)
Production (text box that represents department)
Customer Service (text box that represents department)
I want my query results to show all records that have the "Approved" check box...checked, and then only the records that have one of the Department fields with a null value.
So I'm looking to see only records that are "Approved" and out of those....only the records with at least one department field empty(Null).
Any help doing this is SQL view would be great...or even design view.
lets say I have a table with five tasks for five employees and each employee's data type is with 'Yes or No'.
I need to have a desired result to check
1.if all the employees have completed that particular task then the result should be 'YES'
2.if anyone employee has not completed that particular task then the result should be 'NO'
so, for each task there must be a check on all the five employee's data type.
I have a table and in that table I have multiple columns one being check boxes and another is the description. There are others but these are the relevant ones. I filter under description for HR Payroll but this description is not uniform. After HR Payroll it could vary so the description is not always the same. I want to select all check boxes under this description and was told use a query no clue how to do that though.
View 3 Replies View RelatedI have a form that has three checkboxes (IDDocument, DrivingLicence and Certification) on it. What the form is looking to do is based on the selection it will open a scanned document of the requested documents. There are 5 permutations that could be selected (either first on only, second one only, third one only, first and second and first and third). How do I code the IF Statement this so that the system will look at the different options and then do certain things accordingly.The code I have at the moment is:
Public Sub ProcessRequest_Click()
Dim Form1 As String
Dim Form2 As String
Path = "Staff" & Me!EmployeeName & ""
If Me!IDDocument = True And Me!DrivingLicence = False And Me!Certification = False Then
Do one thing
ElseIf Me!IDDocument = False And Me!DrivingLicence = True And Me!Certification = False Then
Do a second thing
ElseIf Me!IDDocument = False And Me!DrivingLicence = False And Me!Certification = True Then
Do a thrid thing
ElseIf Me!IDDocument = True And Me!DrivingLicence = True And Me!Certification = False Then
Do a forth thing
ElseIf Me!IDDocument = True And Me!DrivingLicence = False And Me!Certification = True Then
Do a final thing
End If
End Sub
All the bits work (the form stuff) but my IF statements are not working. It seems that access is seeing the checkboxes as null and so the IF is not working when i check box 1 and leave the other two unchecked.
The way I'm using the lending library is to check out something that may have multiple of the same item. Rather than making the same exact asset information, is there a way I can check-out the same asset to several people? I think this would cause issues with the Check-in/Check-out query but I'd rather have a function where I could check-out one ID to several people and change the check in where I would have to pick one of the people who have it checked out.
View 4 Replies View RelatedHi,
I really hope someone will be able to help me with this one as I am sure im just missing something simple.
I have an unbound form which has 20 yes/no unbound check boxes. The purpose of the form is to allow users to tick the various fields and a subform return the results. The subform, which does requery when a check box is ticked is based off a query. Initially, I wanted all the records to display before any check boxes are ticked so I have used the following criteria:
Like IIf([Forms]![Search]![Field1]=False,"*",[Forms]![Search]![Field1])
Which basically reads if field1 is no then display all records, else display all yes. Now that works fine but what I would like to have working is that if a client ticks field1, field2, and field3 it displays all records that have ‘yes’ in either field. Currently, if more than field is ticked the query treats it like:
Field1 And Field2 And Field3 And etc = true
I want to be able to select several check boxes and have the query return results for each check box that was checked. I would like to avoid doing this by having an append and delete query per checkbox.
Thank you
I have a form named Member, this form has field named hobbies, this field has multiple values selection i.e. a user could select football, cricket, listening to music and etc. these values are stored in another table and i have looked up the values in my form named member, i know access has multiple value option in combo box while we look up values from another table, but i don't want that the check boxes appear in combo box, they should be listed right in form so that i can see them without going inside the combo box and at the same time the values of these populated check boxes should be stored in a single field.
View 14 Replies View RelatedI have a table of data regarding companies (contact info, etc). The company I work for provides these companies with up to 10 different products. On my input form, I have created 10 check boxes (and thus, 10 columns of Yes/No data in the corresponding table).
Each company has at least 1 product checked off, and up to all 10.
I would like to create a combo box that lists all 10 products, and upon selecting one, a list box then populates with the names of the companies (primary key) that use that specific product.
So, for example,
Company A buys CATS and DOGS from us
Company B buys DOGS
Company C buys CATS and ELEPHANTS
Combo box options: CATS, DOGS, ELEPHANTS
If I choose DOGS, then a list box gets populated with:
Company A
Company B
and when I click either of these, the record should be brought up for the respective company.
All of this should take place in the header of the form, while the form itself can be updated based on search selections.
Sending email using VBA & HTML. I want send email from access. Message in body contains some text and table in HTML format. I need check if email was really sent or cancelled with user.
Code:
Set olApp = Outlook.Application
Set objMail = olApp.CreateItem(olMailItem)
With objMail
'Set body format to HTML
[Code] ...
I need some message (for example):
If error then
MsgBox "Email not sent"
Else
MsgBox "Email sent"
End If
I have a form with 15 unbound text boxes (daily temperatures) and what I am trying to do after entering the temperatures into the text boxes the user clicks an add button which will add 15 new records into the temperature table
the code I have started off with is
Code:
CurrentDb.Execute "INSERT INTO ColdTemperatures (ProductID, ColdTempDate, Temperature) VALUES (" & Lettuce & ", #" & Me.RealTime & "#, " & Me.Lettuce & ")"
which adds 1 successfully however if i repeat the code above for all 15 this Im assumming will create a potential bottleneck and slow the system down
is it possible to add all 15 records at once? do you think Im going at this the right way
I made a database that in one of the forms, I like by clicking on a button the user be able to select 5 excel files with different file names (in the same directory) and then based on the imported file's names, it be stored in 5 different tables.
At the moment by using the bellow code, I can import multiple files (with the same formats) only into one table . My vba code comes as follow:
Function GetAllFiles()
Dim fd As Object
Dim strFilter As String
Dim lngItems As Long
Const msoFileDialogOpen As Long = 3
Const msoFileDialogViewDetails As Long = 2
[Code] ....
I am trying to build a newer database 2010, based on an older one,2000, that has been locked tight and I cannot see the modules to kinda get a reference of where to start. I am trying to find a VBA code that will allow me to import a several text files to one table. The text files are all in the same format but I cannot remove the page headers and footers to get the table to look right. I have attached an example of the text file i am trying to import but it is a stripped down version for information protection.
Also, it appears in the old Database Table once imported as:
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Smith 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
J.Adam 1234 01 ABCD ABCD HGJV 2345 ABCDE ABC6 Qual Date Date
If I could import the text files and end up with a table like this, it would be all i need as i could run all the queries i need from this.
A small issue I was wondering of for a few day . Is it possible in SQL query to SELECT multiple fields from multiple tables ? Example for the question is
Code:
dim my_var as String
my_var = "SELECT Emp_FName , Emp_LName , Emp_Adress " _
& " FROM Table1 " _
& " AND Emp_Date_Of_Payment , Emp_Sum_Of_Payment " _
& "FROM Table2 " _
& " WHERE Emp_ID = 3 "
Is this code actually valid in SQL gramatics , and is it usable if passed to a Recordset variable ( rs = CurrentDB.OpenRecordset(my_var) ) ? Just FYI - The two tables are not related and I want to keep them that way (If possible relate their records just via SQL/Vba )
I am required to write a code to check the positioning of a text in a string.
E.g.
"~[Admin]~xxxxxxxxx~ACK~" = Acknowledged
"~xxxxxxxxx~[Admin]~ACK~" = Not Acknowledged
"~xxxxxxxxx~ACK~[Admin]~" = Not Acknowledged
As you can see, as long as the string starts with "~[Admin]~", it is counted as acknowledged. If the "~[Admin]~" appears anywhere else except the start, it is counted as not acknowledged.
I know I'll have to use If-else statements and EOF to cycle through my entire column, but how do I check the positioning of "~[Admin]~"?
Are there wildcard statements that Access VBA can use similar to SQL's "*"?
I'm trying to create some code that will create a new folder depending on the ID that is currently being added to the database.What happens at the moment is a new ID is generated which in turn is job reference.When this is added to the database a folder is created with a prefix of this ID number and a 20char test specified in a text field by the user.
What I am trying to achieve is this:If the ID = 57...Then a folder is create called 1 - 500 (and ignore if one has already been created, which it should have at ID number 1)...When the ID Number 501 comes along another new folder is create called 501 - 1000 etc etc.The idea is not to have 3000+ folders in just one folder making it look a bit messy and lengthy to look through.
I have created a form which enbles users to enter data into the fields which will add a new record to my table. What I am trying to do now is to create some kind of validation rule that will check whether the record already exists.
I need it to work this way; there are four input fields- 3 text and 1 is a date filed. When the user enters a new record they are not allowed to create a record that conatins the same combination of values. So if one record has for example filed 1 = 1 field 2 = abc field 3 = def; then no other record can have the same combination of values.
If the user enters an already existing combination there would be an error message saying which field is incorrect. If the combination doesn't exist it would add the record and display a message that the record was successfully added.
How can I do this?