I am trying to resolve an issue of being able to use a query from many different forms where the query is dependent on the date selected in the current open form. Right now it calls the function getDate() which works fine. Unfortunatly the function is called before the form is fully loaded and the control I want to pass has no value/doesn't exist yet and I get a "Runtime error 13 Type-Mismatch"
Here is the function code:
Function getDate() As String
If fIsLoaded("F_SupplierData") Then getDate = Form_F_SupplierData.txtDate Else getDate = "01/01/1901" End If
End Function
Function fIsLoaded(ByVal strFormName As String) As Integer 'Returns a 0 if form is not open or a -1 if Open If SysCmd(acSysCmdGetObjectState, acForm, strFormName) <> 0 Then If Forms(strFormName).CurrentView <> 0 Then fIsLoaded = True End If End If End Function
Is there a way to detect the state of the text field itself (if it is open, closed, dirty)? Or if anyone has a better way to tie a query to multiple forms?
I have a query with multiple fields that is being run off of 3 parameters (linked for selection in a form). The problem is, I wanted to enable a select all feature, so I included a "Or ... Is Null" part in my criteria section, so that when nothing is selected, the query/report returns all records.
Okay so the problem is whenever I run the query with nothing selected for the parameter and then return to design view for the query, a new field has been created in the query design, titled with the expression I use to pull the parameter value from the form. This is frustrating because then that is causing errors in another report I run that pulls values from that query.
I have set a parameter in a query on a number field.
When I run the query it lists all entries relating to the number I enter.
Once I have ran the query by either opening the query or clicking on the datasheet view when I am in design view, is there a way that I can re-run the query from the datasheet view with a new parameter without having to either close and re-open the query or go into the design view and click on datasheet view again?
I hope someone can help as I am stumped at present. I have created a calculated query using dateadd. I have a table that has date fields, ServiceContractAgreed and ServiceFrequency. The service frequency field holds a value of 3,6,9 or 12 in months. Using dateadd I can add the months to the ServiceContractAgreed field in a field called NextService, ie =IIf(IsNull([ServiceContractAgreed]),"N/A",DateAdd("m",[ServiceFrequency],[ServiceContractAgreed])) This works fine but what I want to do now is create a parameter query to search the NextService field, using the between operator to search between dates. I've created a new query to do this but get every record back, no matter what dates I put in. It's probably something really simple to do but I'd be really grateful for any advice!
I have a table which has 8 fields. The task is to design a query which always shows the first two fields (or any other two specific fields) and any one of the remaining 6 fields based on the input from the user. I am using a simple form with combo boxes to get the choices from the user.
I have set up a Parameter query which works, and use this on a form.
What I am having a problem with is using an unbound field on the form to be the parameter.
For example in the Empty feild/box on the form I would type SMITH, and this on a click of a button next to it would run the parameter query as a subform.
I am trying to figure out to have the current date populate in table field by using a button on a form and not having much luck.
I have a table with 2 date fields, a 'created' field and a 'received' field. I already have the date set to auto populate for the 'created' field but I don't want the 'received' field to populate until the employee has gone into the database to receive the work.
I know I could have the employee just enter the date, but i want to avoid any typos or people simply forgetting to do it.
Ideally I would love the button to enter the current date into the 'received' field and save the entry, but I fine it needs to be 2 seperate buttons.
I have a form, has some fields, one of them is the current date, so when the user click (save )button , which make (add new record )to the only table I have the problem that .all fields are inserted in the table , except the current date !! it is a text box ( Now() )!!
I'm using Access 2003...I have a query that searches a parts table by description:
Like "*" & [Enter in Part Description to search] & "*"
I need to add another search to this query, I added another field to the parts table call manufacturer. I add this field to the above query and added this parameter to it:
Like [Enter in Manufacturer] & "*"
I then added a manufacturer to one of the fields for test purposes. For some odd reason this doesn't work. If I take out the manufacturer parameter and don't enter in anything into the part description the query returns all the records. When i type a description into the part description field the query returns the proper records. When I add back the manufacturer parameter and enter through both parameters only the one record returns showing the test record instead of all of them. If I put a part description in and enter through the manufacturer parameter no records show when they should.
I've tried adding a test field to a different table and tried a different query using the like parameter. The parameter works in a field already in the table but won't work with the new field I added. I've done compact and repair.
My DB has many (!) forms that are based on Crosstabs queries. The headers are years, and therefore my formfields has controlsources like 2014, 2015 and so on.
Example:
The table it comes from looks something like this:
The crosstab then takes the EndYear as a coloumn header. Then my forms use these fields, now named 2014, 2015, 2016 .... and give me a nice looking table showing the accumulated "end" for multiple projects.
The problem is when the year changes after 31/12, all fields must manually be changed. This means I have to manually change 2014 to 2015, 2015 to 2016 and so on in all of my formsfields controllsource.
I have played around to find a way to change the source of the field, and hoped I could say something like =year(now()) and for the next year say =year(now())+1 but this only returns that year as a value, and not as a controlsource...
The query functions nicely (ive changed the system time, and it has no issues with this structure), but the forms source is still in the previous year, and returns and error (of course).
When the year changes past new years eve, so will the headers (fieldname) change... but how to make the form change fieldsource?
What I really need is for when the form opens, it looks at todays date, then matches current user and then goes to that record for today, if no current user there, then will goto new record..
i know, sounds complicated, and probably is really easy, but my heads not with it today, as about to get drunk as its my 40th, and got people ringing and texting and still trying to get this done....
I've included a copy of this database, named Timecards..
in a continuous form i want to click on one record and have the one field change the background colour to highlight it. When I use the code: Field. BackColor = vbYellow it changes the background on all the records. Is there a code to say only for the record with focus?
Does anybody know how to have a text box on a form "satisfy" a parameter in a query? I want to enter two dates and have a subreport show information from them? (The records shown will only be between those two dates) How do I do this? (I don't want the parameter to pop up on form open) Something like (Date1) = Parameter1 (Date2) = Parameter2
Hi, I have a combo box based on a parameter query, which is on a sub form. I want the query to use the existing value from a field on the main form as the parameter, without getting the "Enter parameter" box. please help.
how to get a Parameter from a form into a query.I have a form with a subform and a table. However I want to enter a number in the Form and then the subform shall display all entries from the table with that number as a specific field. So to speak i want to apply a filter. Can i do that somehow without using VBA ? And without entering the number in that tiny dialog window that pops up when i use "[ ... ]" brackets in my query ? This is may query so far .... and it is the datasrc for my subform ...
Code: SELECT tbl_autos.ID, tbl_autos.Typ, tbl_autos.Alter, tbl_autos.BesitzerID FROM tbl_autos WHERE tbl_autos.GaragenID = <Param>;
i want to replace <Param> with the content of my form.
I wish to change the backcolor of a field on a current record being dispalyed in a 'multiple items' form. However when using me.A.backcolor = makes refrence to all fields called A on the 'multiple items' form and therefore all fields change colour not just the current record.
I know this is probably a basic question- but Im not finding a clear answer here.
Basically- I have a value that I want to select from a drop down box on a form (not created yet). That value will get inserted into my query for a calculation I am doing. The form will pop up the results of the query in a table/dataset.
How do I designate the variable in the query that is being inserted from the form? I am using Access 2002- is there a way to visually perform this task (ie- drag/drop type thing)? Thanks guys!
I have a report query that uses a combo box on a form to collect the parameters. I would like to be able to include an option that would be like not having any criteria at all, to show all the records. I have tried several combinations in the criteria to get it to work and haven't found a way yet.
I have tried various different versions of what you see above and none have worked. The true part and the false part both work if separated and tested. Is it possible to make this work or is there better way to do this?
I am struggling with what seems like should be a straightforward task. Unexpectedly however it has become an infuriatingly difficult one (no doubt due to my complete novice status).
I have a very basic d/base (3 tables) that I have been searching using basic SQL queries. I want to create a simple 'search' form that produces the results of my various queries without the need to work in SQL. Enter one or more search criteria, hit ENTER, results presented in datasheet perhaps?
Thought this would have been easy but I've had no luck. Can you please explain how I can pass a parameter from a form to a query?
I am not a programmer and I don't know VBA/VB. I am using this as a workaround to avoid VBA functions (since I don't know them). I can't seem to find a simple? solution to this. I have a query that does a radial search in decimal degrees. I have created an unbound form as a dialogue box that converts degrees-minutes-seconds to decimal degrees and displays the results in a calculated text box. What I want to do is have the query take the results in the calculated text box as its parameters (along with a third parameter- distance) without prompting the user. How do I get the query to take its results from the fields on the form? I have tried Like [Forms]![frmName]![SearchValue], but I can't seem to make it work.
I have always used parameter forms for inputing query/report criteria. However, they have always been for one query or report. However, all searches I have done for trying to use one form for several queries all I find is a simple response of "Create a form and then direct all the queries to grab the parameter from the form.". Sounds simple enough but I can never get it to work.
I have created a macro that runs 12 Append queries. I have also created a parameter form that has an unbound combo box. The combo box is fed by a query that gathers all the Data Dates for the user to select from. So if there are 24 different data dates then the combo box displays them all.
I tried creating a macro that first opens the form then opens the query, however, it runs the query before I can finish entering the criteria in the form. Then I just get a pop up of "You are about to append 0 records..."I have found several walk-throughs for having a query use a form to grab parameter, but have not been able to find one that shows you how to set up one form to run several queries.
I keep trying to find an answer, then give up and continue manually entering 12 dates for 12 queries when they pop up after running the macro. Now I need to create a macro that runs 24 queries and I don't want to have to go through 24 parameter pop-ups.