This Is Driving Me Nuts - Query Criteria From A Text Box.
Oct 15, 2007
I have form that will pop up to run a report, and allow the user to select a state for that report.
There is a combo box which you can select a state, then based on what state it is, it puts a criteria value into an unbound text box on the form.
The query has this set as the criteria:
[Forms]![frmStateSelection].[txtStateFilter].[Value]
I have also tried just:
[Forms]![frmStateSelection].[txtStateFilter]
The value of the text box is:
Like '5???????'
When the query is run, it returns 0 results. However, if I put in Like '5???????' as the criteria in the query itself, it runs properly.
I tried closing the form and running the query so that it asks me for a value since it can't find that textbox since the form is closed. I pasted in Like '5???????' and it returns 0 results.
I have used this method for entering start and end dates for reports before and it has worked just fine. I can't figure out why it isn't working here. Any thoughts?
View Replies
ADVERTISEMENT
Jan 14, 2006
Hi
I am having a real hard time with access weared errors. I am using following code:
Me.HistorySymptoms.Form.Refresh 'Just to make sure. It was a try because of error
If Me.HistorySymptomTab.Visible = True Then 'It is a subform in a tab page
For counter = 0 To 29 'Number of fields in the recordset
If IsNull(rs.Fields(1 + counter).value) = False Then ' Just to check Null values
MsgBox rs.Fields(counter).Name 'For debugging
Old_History(counter) = rs.Fields(1 + counter).value 'This line has problem
End If
MsgBox rs.Fields(counter).Name & " Done.||" & counter
Next counter
End If
The error comes in the maked line on accessing the field value. Previously I had another error but after going through the process of "Corrupt Access file correction", I am getting this one. My form has subforms in tabpages. I want to save all the field values to the array on pressing a button. Button is part of the main form and code copies values from a subform. I don't think my file is corrupt as I went through the process twice :-(
Looking for help
RMA
View 2 Replies
View Related
Nov 13, 2006
hi,
i made an attendance db for work and got it to work. i then copied it and made two more for years 2 and 3. Years 1 and 3 work perefectly but for some reason the year 2 db won't allow me to write the data.
this is driving me nuts as i have already spent a few hours putting the students in and their course selections. i've tried making the forms again and as soon as i use a joint sub form to get the students first name the problem occurs. i've looked at the properties of the forms and they allow edits etc..
if anyone is feeling kind and has a spare moment, could you let me know why it doesn't work.
cheers
View 6 Replies
View Related
Feb 15, 2007
Hi all,
im having trouble with an update query wher i need to update one field [class] of a table [txStudents] from an existing query Newfacility_Students where the StudentId in [txStudents] matches the StudentId in Newfacility_Students
thought it would be simple enough
UPDATE txStudents
SET Class = Newfacility_Students.class
WHERE ((StudentId = Newfacility_Students.StudentId));
it's not working it says it prompts me for this Newfacility_Students.class
but when i add that table to the design view it messes up the syntax in the sql view
UPDATE txStudents Newfacility_Students
SET Class = Newfacility_Students.class
WHERE ((StudentId = Newfacility_Students.StudentId));
any ideas?
im going crazy!!
dubs
View 1 Replies
View Related
Dec 10, 2006
Hi, How can I make the data in a textbox on my form automatically entered as the search criteria in a query. So say the box says Mike Johnson, can I make a command button (That I can eventually subsititute as the actual box) that puts the Nma emIk Johnson into a search query and brings up all the information on him from the database?
View 4 Replies
View Related
Aug 20, 2004
I am really green when it comes to Access---i am entering
text variables and pushing tab to get to the next field..however,
when I push tab to get to next field it the program is automatically
counting by two's, three's etc. based on 'pattern.' For example-I entered
2, then tab 4 and when I tabbed again a 6 magically appeared. I need
to know how this can be turned off...it is driving me nutty.
View 1 Replies
View Related
Oct 13, 2005
Hi All,
I've been developing the code below but when the length of .lstAnswers is longer than 128 it doesn't delete the question.
Is there a reason under queries or SQL this should happen? I'm hoping that i'm just thick and there's an easy answer but nothing seems to work.
--------------------------------------------------------------------------
Private Sub cmdRemoveAnswer_Click()
Dim Answers_SQL As String
Answers_SQL = "DELETE tblOptions.* " & _
"FROM tblOptions " & _
"WHERE (((tblOptions.strAnswer)=[Forms]![frmQuestionWizard]![lstAnswers]) AND ((tblOptions.strQuestion)=[Forms]![frmQuestionWizard]![lstQuestion])) OR (((tblOptions.strAnswer) Is Null))"
DoCmd.RunSQL Answers_SQL, 0
lstAnswers.Requery
End Sub
--------------------------------------------------------------------------
View 2 Replies
View Related
Oct 25, 2006
Simple question but I've been stuck for a looong time.
So what I want to do:
1. enter a value into a text box (Home_Tel) in a form (frmStudentClass)
2. which runs a query (qryNameTel)
3. and return the results to a combo box (Student_Name) on the same form.
The same Home_Tel may have several Student_Name results.
-I have entered
[Forms]![frmStudentClass]![Home Tel]
for the criteria in the query
- However I can't get the results to turn up on the combo box
- I have the following:
Private Sub Home_Tel_AfterUpdate()
' run query
DoCmd.OpenQuery "qryNameTel"
Me.Student_Name.Requery
End Sub
Any ideas?
Or is there an easier way to tackle the problem?
Home_Tel and Student_Name are from the same tables.
I have created a query just for Home_Tel and Student_Name
Thanks everyone!
View 1 Replies
View Related
Feb 26, 2014
I'm trying set the query criteria from a textbox on a form. It's a Status field in the query. 1 = Open, 2 = Closed. If I set the criteria to "1" it shows all open, "2" and it shows all closed and "1" or "2" it shows all. The problem I'm having is setting these in the form. I've set the query to pull the value from the form. I can get the Open or Closed to work but not the All. My textbox shows exactly how the criteria should read "1" or "2" but doesn't show any results.
View 3 Replies
View Related
Aug 31, 2014
I've got a continuous form based on a query.Each of the fields have a search box below it (in the footer) which should ideally filter the query.I'm starting with the FirstName field.In the form's query, I've set the criteria to the following for the FirstName field:
Code:
Like "*" & [Forms]![frmStudentDetails]![txtSearchFirstName] & "*"
frmStudentDetails is the form name.
txtSearchFirstName is the search box's name (in the footer).
The AfterUpdate event for txtSearchFirstName is:
Code:
Me.Requery
But, it doesn't work; when I switch to form view, it displays an error. The Microsoft Access database engine does not recognize '[Forms]![frmStudent Details]![txtSearchFirstName]' as a valid field name or expression.
View 12 Replies
View Related
Sep 10, 2007
I sure am having difficulty with this. I'm trying to have the criteria in my form refer to a text box within one of my forms which is the text as I would write it myself within the query design view.
Query's [DEST_ZIP5] criteria = [Forms]![Mainswitchboard]![QueryWizard].[form]![calcDestZip5]
[calcDestZip5]'s value in QueryWizard form = "55422" OR "55343"
Basically, I just want to be able to enter the text string within a form instead of within the query. Sure this can be done!
Oh, and for what it's worth...
If, [calcDestZip5]'s value in QueryWizard form = "55422"
Then the query runs just fine. It's as if the query doesn't want to accept multiple criteria from another source.
TIA
View 5 Replies
View Related
Dec 11, 2013
I have a totals query that provides an avg for each month. i'd like to be able to use a text box control (named "Date") on a form (named "Report Runner") to show only a certain month and it's avg.
I tried using this as criteria on the "MonthGroupPMC" field:
Code:
Format([Forms]![Report Runner]![Date], "yyyy-mm")
but the results came up blank.
how can i filter the results of this query to show only one month, specified by the [Forms]![Report Runner]![Date] control?
View 5 Replies
View Related
Dec 12, 2014
Am not getting a value from a form text box when using in the criteria line in my query. Am referencing like [Forms]![FormName]![FormLabelName]. If I copy the data in the form and paste it into the query, it works fine, but if I just reference the form, I get no results.
View 13 Replies
View Related
Jun 5, 2015
I have text field that is storing both dates, and "N/A."
I'm trying to to get only records that match this format "mm/dd/yyyy" or "xx/xx/xxxx"
Are there any format functions for query criteria, like must match this format "__/__/____" ?
I know I can just use "<> "N/A"" however I want "<> "N/A" AND Format = "__/__/____"
View 3 Replies
View Related
May 7, 2014
I've been writing queries in the following format for years in Access 2003, but having recently transistioned to Access 2010, I've found the following sql doesn't work.transform
sum(s.value)
SELECT
s.sn, s.ln, s.pn, s.id, s.lat, s.point, s.supply_type, s.used, s.real, s.code, c.name
FROM
supply_points s
, codes c
WHERE
s.code = c.code
and s.id is not null
and s.code = 1075
and s.month >=[forms]![main]![gppstart ]
group by
s.sn, s.ln, s.pn, s.id, s.lat, s.point, s.supply_type, s.used, s.real, s.code, c.name
pivot
s.month
In Access 2010, this query returns the following error message:the Microsoft Access database does not recognize '[forms]![main]![gppstart]' as a valid field name or expression
Is this a common phenomena in Access 2010?
View 3 Replies
View Related
Dec 18, 2013
I am trying to run a query and display the results in a report (the report side of it is childs play and not a problem). The problem I am having is that I have a search form which should allow the user to search any one of 6 fields (text boxes) or a combination of each.
If the user enters something into a field then that search criteria must match. I wanted to have it so if all fields are left blank then it will show all entries in the database (but it isn't, it shows a blank report). I also wanted it to allow partial completion of boxes.
So for instance if I have 5 customers (Jones, Jonson, Jonus, jimjonkins, Janis) and I type "Jon" into the name field then I would like it to show the first 4 records as they all contain "jon" somewhere in their name but its not, its only allowing exact matches.
I currently have '[forms]![Search_Customer]![Search_Name]'.
View 2 Replies
View Related
Apr 15, 2014
I'm trying to pull a date from a table into a text box on a form tab control using DLookup and I just can't figure out what is wrong with my DLookup expression:
=DLookUp("DateOrdered","tDateOrdered","PrNumber=" & [PrNumber]) ----- (DateOrdered is short date, PrNumber is text, db is split Access 2013)
Whats missing in this expression? I've tried every criteria variant I could find but to no avail.
View 9 Replies
View Related
Mar 18, 2005
Can someone please help me because this is driving me insane!!
All I want to do is open a form which automatically copies the ExampleID from another form which is open.
For example on an Orders Form there will be an OrderID (Primary Key) so when I click to open the OrderItems form, which will open so that I can add an item to the Order, I need the same OrderID (Foreign Key) to automatically match the OrderID from the Orders form.
I've tried making the default value for the OrderID (Foreign Key) = the OrderID on the Orders form but the database doesn't like this method and produces errors!
Does that make sense? I hope so as I am in need of a very kind persons help!!!
Thanks,
Paul.
View 5 Replies
View Related
Nov 9, 2005
My query looks like this...The problem is that when I have one Radio with two records where [Defect fixed?] is false it counts that as two separate radios instead of one. Somehow I need to make it sum records with the same Radio/Serial_number as one...Anyone have any suggestions?
SELECT DISTINCT Defect_Log.[Defect Fixed?], Defect_Log.Station, Part_Number_Log.Type
FROM Part_Number_Log INNER JOIN (Serial_Number_Log INNER JOIN Defect_Log ON Serial_Number_Log.Serial_Number = Defect_Log.Serial_Number) ON Part_Number_Log.[Part Number] = Serial_Number_Log.Part_Number
GROUP BY Defect_Log.[Defect Fixed?], Defect_Log.Station, Part_Number_Log.Type
HAVING (((Defect_Log.[Defect Fixed?])=False) AND ((Defect_Log.Station)="station 1") AND ((Part_Number_Log.Type)="vhf"));
View 1 Replies
View Related
Sep 11, 2004
I have attached a very small table with one query. I need help having the query perform a calculation. NOTE: I do not want to achieve the calculation in a form or a report.
Thanks so much for the help - John
View 3 Replies
View Related
Mar 3, 2007
Hi,
I'm trying to build a mdb which holds customer details, which insurance they have, who sold them this and which Insurance company provided this.
The relations I have to make are driving me nuts !
When I try to enter a new customer in a Form, there is a advisor added, the package the customer wants is added. But this shouldn't happen for the advisor and the package allready exists !
Who can help me with the proper relations ?
Attached is screendump of the current relations.
Thanks a lot !
View 8 Replies
View Related
Mar 15, 2008
Hi, i have several tables in my database, wanted to know if the tables between:
Client -----> Theory
Client -----> Practical
are 1 to 1 relationship, right? Client can do one Theory, Practical.. but what if Client failed Theory, is that saying they can do more? I'm confused with the whole logic on this. Any help would be appreciated.
Thank You! :)
View 2 Replies
View Related
Oct 18, 2006
Hehe... and since me and my girlfriend just broke up, that seems applicaple both in the dbase and the real world ;)
I have one Access Database. For now containing three Tables:
KlantNAW (customer adress data) with one primary key, Klantnummer (clientnumber) which is an Autonumber Data Type, Long Int, Increment, Indexed: Yes (No dupes).
CaseDateTimeInfoTable with one primary key, Casenumber which is an Autonumber type, Long Int, Incremental, Indexed: Yes (No dupes).
Within this table I have included the Klantnummer field from KlantNAW as a Number, Indexed: Yes (dupes OK).
CaseTechInfoTable with no primary keys but with both the KlantNummer field and the CaseNumber field included. Both have a direct relationship to the tables in which those two values are created. Both values are now of type Number, both are Indexed, but Klantnummer is set to Duplicates OK and Casenumber is set to No Duplicates. I don't know if it might be wiser to just not index those values in this table, since they are already indexed in the tables in which they are created, if someone could tell me which is better in this case, please do.
I have created a one-to-many relationship (well actually, access seems to decide whether it becomes a one-to-many or one-to-one relationship) between KlantNAW.Klantnummer and CaseDateTimeInfoTable.Klantnummer with Join Type 1 and I've created a Join Type 1, one-to-many relationship between KlantNAW.Klantnummer and CaseTechInfoTable.Klantnummer.
There is only one extra relationship left, which is a one-to-one, Join Type 1 CaseDateTimeInfoTable.CaseNumber with CaseTechInfoTable.CaseNumber.
So ehrm.... a recap:
KlantNAW.Klantnummer (P-key) with CaseDateTimeInfoTable.Klantnummer
KlantNAW.Klantnummer (P-key) with CaseTechInfoTable.Klantnummer
CaseDateTimeInfoTable.CaseNumber (P-key) with CaseTechInfoTable.Casenumber
If I leave it like that the dbase works perfectly except for the fact that when I delete a customer the related case date/time info and the case tech info don't delete with the client account accordingly.
So, I thought I'd "Enforce Referential Integrity" and "Cascade Delete Related Records". I do not know if it would be wise to also enable "Cascade Update Related Fields". Could someone please tell me if that would be wise to do or not? And maybe even why... I have some beginner and more advanced books but can't be sure, probably because of lack of experience (or maybe lack of brains ;) ).
Anyway, back to the problem: when I make all the relationships to Enforce Rererential Integrity and I add a customer through a form (KlantNAW_InvoerForm) and click the "Create new case for this customer" button, the form I use for entering the case date info pops up nicely, but when I try to close that form I get an Error stating: "You cannot add or change a record because a related record is required in table "KlantNAW"". So, I click ok, then get a messagebox stating I can't save the record at this time. Do I want to close anyway? .... well, ok. Let's do that. And now the strange thing is that after that, when I do absolutely nothing other than pressing the create new case button again, enter the date/time info into the form and close it again, no errors or messages come up. Wel... that should happen the first time around right? What's wrong?
Now... I'm really lost. I'm new at this. I made some tables, queries and forms, set all options for all values, that which I didn't understand mostly tried solving or finding out on my own but now I'm hitting a brick wall.
If you guys and gals could help me out I would really be very grateful for that.
EDIT: I even tried making it more simple by removing all relationships and creating just one new one between KlantNAW.KlantNummer and CaseDateTimeInfoTable.Klantnummer (type 1, enforce referential integrity and cascade deleted records) but still, the same problem arises.
EDIT2: made sure it was not a form thing by just putting in data in the table data views directly. Same thing occurs.
View 14 Replies
View Related
Nov 13, 2007
I just started learning Access and I have created a database with 53 records, 3 tables and 1 Split form. I creared a new yes/no field and I am attempting to display "Completed" in green for yes and "Not Completed" in red for no. I used the correct code in the format field:
"Not Completed "[Red];" Completed "[Green]
This worked for different field before I created the split form but now I cannot get the new field to display anything but check boxes regardless of what code I use. It won't even let me use the default yes/no, true/false or on/off options.
I've been studying this for about 2 weeks and I've figured out quite a bit but this one thing is really iritating me....:eek:
Help
Any comments would be appreciated
John
View 3 Replies
View Related
Jul 19, 2005
I am trying to create a chart on a Form. In Excel I have no problems arranging my data. This is my first try for charts in Access. I have a table. I created a query summing two fields of this table:
Total Workers
Total Workers: DCount("[WorkerNameLast]","1-StationVerifyTbl","[ClockNbr]<>'*'")
Total Workers = 120
Total Verified
Verified Workers: DCount("[WorkerNameLast]","1-StationVerifyTbl","[StaPrimary]=True")
Total Verified = 43
So far so good. That is the correct information. What I want in a Chart is two bars side by side. One bar at 120 and the other bar at 43. I have tried everything and cannot get this to work. I am getting confused on the Axis, Data, & Series. I think I need another Field somehow. The totals I would call Monthly Totals
Could someone please help me get this thing started. I have wasted a week and feel like I have learned nothing except how to count in the Query.
After this I would like to be able to show a percentage of those verified. I have 120 workers and 43 are verified. That would be approx 35%. Anyway I am assuming that there is a solution and that I am just floundering for nothing. Thanks in advance.
View 8 Replies
View Related
May 27, 2006
I have a subform with textboxes for data entry.
I want the last data entered to stay displayed in the textboxes after the form is closed.
When the form is re-opened the textboxes display a row af data several rows down.
How do you link the textboxes to the feilds of the subform the new data is always at the top row.
Example:
Form textboxes data Entry:
Apples Oranges Pears grapes
Click command button to save:
Subform displays
Apples Oranges Pears grapes
Grapes Kiwi Tangerines Corn
Beans Lettuce Okra Rice
Close form Text boxes still display Apples Oranges Pears Grapes
Open form back up
Text Boxes Display
Grapes Kiwi Tangerines Corn
Subform Displays:
Apples Oranges Pears grapes
Grapes Kiwi Tangerines Corn
Beans Lettuce Okra Rice
How Can I make this work Right?
If anyone knows how to do this please Help.
If it must be done in code please provide an example.
I need to get this worked out this weekend.
Thanks for all the help
You guys are great!:D
Charles
View 4 Replies
View Related