Forms :: Search By Textboxes Using Query?
Oct 21, 2013
I've got a form called "Main Menu" and i'm in the process of implementing a search form into it. So far I have three textboxes called TBFirstName, TBSurname and TBCentre these are unbound. I also have a search button.
This button runs the query which runs the search, the sql for this query is below.
Code:
SELECT Staff.[Employee ID] AS [Staff_Employee ID], Staff.Forename,
Staff.Surname, Staff.Sex, Staff.[Job Role], Staff.[Start Date], Staff.[Leave Date], Staff.Centre,
Staff.Hours, Qualifications.[Employee ID] AS [Qualifications_Employee ID],
Qualifications.[Level 2 Maths], Qualifications.[Level 2 English], Qualifications.[Level 3 Support Maths],
[Code] ....
Whenever I run this query it just returns all the records instead of the search criteria. Where am I going wrong?
View Replies
ADVERTISEMENT
Dec 31, 2004
Im just starting to program in Access.. can somebody please help me with my problem?
Im trying to figure out how to search the table with the content of my textbox. (Ex. i input "A" in my textbox, it should display all the records of "A" like it's AGE, STATUS, etc.) it doesn't have to be case sensitive or exact because i have a primary key that doesn't accept duplicate.
Thanks to anyone who'll help
View 3 Replies
View Related
Aug 1, 2013
I'm relatively new to MS Access (using MS Access 2013 but the db should work on 2010, too) and try to develop a database for an NGO I'm working in. I created almost all the tables (all that I need for now) and made the relationships.
However now I start to create forms and later reports for the actual user. The database will store information about clients and track consultations and assistance the NGO gives to them. There will be around 50.000 to 70.000 clients in the main table. Every client has a specific Individual ID and is member of a family which itself has another specific Group ID.
Now here is my problem: The User usually searches for the respective family by the Group ID. I implemented this with a search query using the ID number of a search text box. All done and no big problem.
But sometimes the ID number is not known so the user needs to search by name (First and Last Name). I use to different textboxes for this and it works in a similar way like the number search by query (Like "*" & [Forms]![frm_SearchIC]![txt_LName] & "*"). All still good However since most of the clients are actually from arabic speaking countries, converting the names into the Latin alphabet is bound to fail and produce a lot of misspellings. Therefore I added 2 more textboxes and 3 comboboxes for the user to give more information about the client and therefore make it easier to search for the person. I was able to produce a query which gives you the right result if you have ALL information at hand. However, this is not always the case.
1) But I cannot find a way to tell the query that if the a certain textbox or combobox is empty, it shall just "ignore" it and use the information at hand. I tried this in the query by adding in the criteria OR .... Is Null. This is alright for one or two textboxes but for the many I have, it seems to be too many different combinations for the criteria. It just worked with some fields but others always had to be filled in...
2) If no information is given at all, the database should inform the user that he needs to enter at least on field. If nothing is found the user should get a msgBox saying "No IC matches your criteria".
3) The results of the searches should be given out in another form where the user can pick the person from 1-to-many results.
I attached a sample database with sample data and reduced tables, fields, and entries ...
View 6 Replies
View Related
Aug 15, 2013
I have a form with two textboxes called: txtAptDep, txtAptArr.
On their right side there are two buttons (btn1, btn2) to open a form called frmAirportSearch. It allows to choose (from a listbox) the airport to be filled in those two textboxes.
Now, if I search for an airport pressing btn1, I want the airport to be returned into txtAptDep, while if I open the form by btn2, the airport choosen must be returned in the second textbox.
View 7 Replies
View Related
Jan 27, 2014
I've tried manipulating my code in always but cant solve my current issue.My 3 tables are Clientdetails, Clientcontact and Clientdoctor.All the lookups below work fine. clientname is a textbox i use to search the Database and populate my form unbound. i want to populate other textboxes with data from Clientcontact table as well. I'm using a command button relevant to the clientname search.
D = DLookup("[ID]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Forename = DLookup("[Forename]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Surname = DLookup("[Surname]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address1 = DLookup("[Address1]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
Address2 = DLookup("[Address2]", "[Clientdetails]", "[Surname] ='" & [Forms]![unboundfrm]![clientname] & "'")
[code]...
View 1 Replies
View Related
May 16, 2014
I have a continuous form and having trouble with the layout. When i fill in the record and then tab to the new record it displays the textboxes on top of the last one instead creating a new line bellow?
View 2 Replies
View Related
Dec 16, 2013
When moving to a new a record in my form, i will click on a text box and the following happens:The black line will flash much faster than normal (This will happen on any text box i click on) No text will appear while this is happening When it stops al the text that was typed in that period will appear After this 5 to 10 second text delay the text box and all other textboxes will work fine, until i move to a new record and the process starts again
View 2 Replies
View Related
Jul 24, 2015
I haven't been able to find if there is a maximum length of text within a textbox.
I have a form on a club database, and one of the textboxes has the details of their photographic experience. I have one person who is a very experienced worker and I need to add more details in the textbox. Currently there are 29 characters, including spaces in the box, but it won't allow me to add any more. I have set the width of the box on the form to a wider setting, but this makes no difference. What can I do?
View 5 Replies
View Related
Oct 12, 2014
I have three textboxes , textbox 1,textbox 2, and textbox 3, I can change the value of textbox 3 based on the date of textbox 2 by using
if me. textbox2 < date then
me. textbox 3 ="expired"
end if
but I need it to look at textbox 1 as well and only change textbox 3 to "expired" if both conditions are true. example
if textbox 1 = "abs" and
textbox 2 < date
then textbox 3 = "expired".
end if
View 10 Replies
View Related
Aug 28, 2014
When a user selects a name from a combo box then 11 textboxes are populated with personal information.
What I am looking for is when the user edits the persons information (i.e. changes the persons phone number to a different number), how do I update the table with this information?
Is there a way to only update fields that have changed? or do I have to save all textboxes?
I have read about an "Update Query" and a SQL Update, but I did not think the two applied. I am sure that I am wrong, lol.
I tried the "Docmd.Runcommand acCmdSave (in the OnClick event cmd button) but it did not make any changes to the table.
This is what I put in the OnClick event:
Code:
Private Sub cmdSaveEdit_Click()
DoCmd.RunCommand acCmdSave
TextBoxLockDown
Me.Requery
End Sub
View 2 Replies
View Related
May 24, 2013
I have a form with checkboxes, indicating fields which can be selected for a query. The strSQL variable works fine, and I can use QUERYDEF to create a query from the variable.
I wonder if it is possible to generate a form to display only the fields chosen - i.e. I don't want a general form with all fields, with only the chosen ones displaying data. Instead, if I select only 5 of the 10 fields, I want the form only to show those 5 fields.
Creating textboxes for each field, and using the .visible property, but then I would have lots of gaps on the form.
I hoped it might be possible to use a loop with a value set something like
For i = 1 to fieldcount
textbox(i).recordsource = selectedfld(i)
'somehow know where to place the textbox!?!!
Next
View 14 Replies
View Related
Apr 9, 2013
I'm trying to make a template form for a helpdesk, at the bottom would be a "Copy to Cliboard" button that when pressed will copy to clipboard in the format of:
label1 textbox1
label2 textbox2
label3 etc...
I got the jist of it, but got lost somewhere along the way, this is what I have so far:
Code:
Option Compare Database
Option Explicit
Private Function fcopyfields() As String
Dim strapp As String
Dim strapplabel As String
[Code] ....
It's falling apart at the button click.
View 2 Replies
View Related
Dec 12, 2013
I have a form to input info into a table how can I combine 2 txtboxes to one column separated by ", "
Example:
textboxes:
txtboxFirstName txtboxLastName
output:
Last, First
into the "Name" Field in my table
View 1 Replies
View Related
Sep 5, 2013
I have a form and I am not sure of the best way to populate the multiple fields on it.
The form consists of a textbox to select a date (txtDate) and then once this date is selected I want the multiple textboxes on the form to be populated from data I have in a table.
The name of each textbox is a concatenation of "txt" the number of the person which is a number from 1 to 4 and then a time eg for 12 Noon it would be 1200 so the textboxes are from txt10800 to txt42000 i.e. each person has textboxes from 8.00am to 8.00pm in half hour intervals.
I need to use two tables to populate these textboxes as in the main table there are codes that have a relationship to fields within another table that holds attributes for that code. (eg code 123 could equal Service A in the second Table but 123 is what is held on the main table) Also in the main table I have a calculated field that creates the name of the relevant textboxes on the form.
If there is a textbox that will not be populated as there is nothing in that time period then I would like this to be left blank or Null.
Am I best creating a query and binding the form to this query or to leave it unbounded and use a recordset within VBA
Also what is the best way of using either
I am using Access 2013...
View 5 Replies
View Related
Aug 4, 2014
Retrieval of data from a query and putting it into a textbox on a form. I currently have a form where I would like to put in a Job Number, and then hit an "Update" button and it will show some of the data fields associated with that Job Number. I have a table called "All Jobs" and each Job Number is unique. Where I'm really having issues with is in regards to Dates and Boolean fields.
In one form, I put in a job number and it will bring up the Company, Motor type, Received Date, and Quote. I have been able to retrieve the Company, Motor, and Quote with a DLookUp expression using a query. The expression looks like:
CompanyName.Value = DLookUp("Company","Approved Job Form - Find Job Info").
CompanyName would be the name of the textbox on the form, with "Company" the field within the "Approved Job Form - Find Job Info" query. The query itself uses the job number entered onto the form and returns the other data fields associated with that job number. Running the query by itself returns the correct information. My issue comes with using the Date Received field. It seems that because that field type is a Short Date, my DLookUp expression keeps prompting the debugger in the code. Currently I have:
RcvDate.Value = DLookUp("Receive Date","Approved Job Form - Find Job Info")
This will not bring the date from the query into my text box like the others.
In another form, I'm also having issues with a Boolean data field. I would like to have a query that looks up a job number, and if my data field (Job On Hold) is checked (True), I would like it to return a value of "Job On Hold / In Progress" into a text box. If it is unchecked (False), I would like it to return "Job Approved". I've tried a bunch of different ways to make it work, but I'm really stumped. The makeshift code I last tried (I've tried this numerous ways, so I'm not sure if I was closer before) is:
Dim jobstatus As Boolean
jobstatus = DLookup("Job on Hold", "Job Status Form - Search Status")
If jobstatus = False Then
Status.Value = "Job Approved"
Else
Status.Value = "Job On Hold / In Progress"
End If
View 6 Replies
View Related
Feb 16, 2006
Does anyone know how to run a query in VBA that will update TextBoxes in a form?
View 3 Replies
View Related
May 3, 2013
no problem about setting a different border color for a single textbox (or combobox or listbox) which has focus. How about to change, with a small and fast VBA code avoiding to write code for each textbox, the border color (ora other textbox properties) for a many controls in a form?
I tried using 'For each ctrl in Form....', but I got only bad results. All my control are within differente pages in TAB control.
View 14 Replies
View Related
May 11, 2014
I have a form with 2 option buttons on it one with year 12 on it and one with year 13. I have a simple form with drop down menus and text boxes allocated for year 12s and 13s. I want all of the year 13 text boxes and drop down lists to be locked if year 12 is selected and I want all of the year 12 text boxes and drop down lists to be locked if year 13 is selected. I do not want to over complicate the form by hiding parts of it or having a new form open depending on the option button selected.
View 9 Replies
View Related
Aug 24, 2013
I have a form with 7 types of weights (7 textbox rows) showing 7 weights in kgs and the others in lbs.When the user update any weight-kgs textbox, the opposite weight-lbs textbox will be updated automatically, and viceversa.Now, I'd like a fast way to code this action without writing the After Update_event for every textbox (they're 14).I have already setup textbox tags differently with "WeightKGS" and "WeightLBS", thinking about using "for each ... next" statement, but I have some problems to resolve what I want.
View 4 Replies
View Related
Aug 21, 2014
I have a form that has four textboxes, date dropdown box and a date box. I am trying to get the form to do the following: Block user from writing in the textboxes if they have not selected a date in the date box.
Get the datebox to look at the behide screens records to see if there has already been a documented date (duplicate date) and inform the user that this date has already been used. Then auto them to the date dropdown.
View 2 Replies
View Related
Jul 9, 2013
I have a form with two textboxes that get their values from two different queries that counts records from table. If textbox1.value equals texbox2.value the textbox2.value back ground colour is green. If they are not equal textbox2.value goes red. Itried with using conditional formatting, but it doesn't work all the time as the form is not updating when it is opened.
View 4 Replies
View Related
Jan 28, 2014
I have a search form that uses several comboboxes, textboxes and checkboxes that are used as criteria in a query. You enter in the relevant information, hit search and a report opens based on the filtered query.
What I would like to do is change one of these combo boxes to a listbox and use the multiple selection as the query criteria. I know it's not as simple as just putting the listbox as a criteria in the query, and I've also tried many different variations on the varItem and strWhere code.
View 14 Replies
View Related
Dec 16, 2013
I am having some difficulty putting togather a small database (attached).
Basically I want to be able to search for mutiple words and get the results
There are 3 main columns in the main table
1) Shop
2) Part Number
3) Part Type
Problem 1:I have created a lookup table (with check boxes) for ComboBoxes in a form but I do not know how to connect it so that when I click on the comobo box it gives me the all different (Shop numbers/part number/Part types) to select from.
Problem 2:Once I have made my selection I want to search and run query to show me the results. I know that once multiple items are selected in a combo box they are separated by commas/space, so the search must take that in account.
Other nice to have
1) If Shop 1 is selected then only the parts which were sold from shop 1 to appear in the Part number Box & visavera & same goes for Part type.
2) Ability to do a wildcard search so if I Enter "A" in part number I can see all the resealts
View 12 Replies
View Related
Apr 17, 2015
I have a form based on a query. I'd like to add a search box to the top to look up values and then populate the rest of the form. I can't do it with the combo box wizard because the relevant (third) option doesn't show up, I assume that's because the form is based on a query not a table.
Any alternative method of adding a search?
View 4 Replies
View Related
Mar 14, 2013
I have created a form for a table which contains ~600 movies and their name, genre, rating, director, year it was made, and length (min).I need to be able to enter numbers into the two Year boxes, and then it filters the movies in my database and only shows me records from between those two years. The years in my database are just in one column in the format of: XXXX e.g. 1996 etc..I've tried the code:
Code:
Private Sub Year2_AfterUpdate()
Me.Filter = "[Year] BETWEEN" & Me.Year1 & "AND" & Me.Year2
Me.Filteron = True
Debug.Print "[Year] BETWEEN" & Me.Year1 & "AND" & Me.Year2
End Sub
Year1 and Year2 are the boxes Year: and To: respectively. [Year] just being the column name which contains all my years.When I try to run my query it shows me my records, but it shows me all of them! It doesn't filter it at all!
View 4 Replies
View Related
Jun 10, 2013
I currently have a database with a few search forms. I recently attempted to add a box on one of my search forms to search 3 cells of a record for a key word. What happens is when I go to search, say for P0442, it does not bring up all of the records that contain that keyword in the 3 cells I have outlined. If I step down the code in the OR boxes of the query, it seems to work better but then for some reason my other search criteria , (Tracking number etc) does not work. I will upload the database for reference. I am currently working on the Search(View Only) and that is where you will find the query to work on.
View 3 Replies
View Related