Hi I have a couple of tables that should have an automathed value.
What I need is to get the last RecordId from the table from where we get the last RecordNr and insert the next value (RecordNr) in a new record.
I tried to do this autom. in the table by making the RecordNr a numeric Value with a mask for 000 numbers and a +1 as a standard value but it doesn't work.
What can I do? Should it be a function/query?
I am creating a query which determines the number of days a payment is delinquent. Is there a function I can use in a query field that would look at the numeric field and if the value of the subject field was: < 60 Days "30-59 days" < 90 Days "60-89 Days" <120 Days "90-119 Days" >=120 Days "120 Days +"
It was my understanding that the IIF function tests for a condition and can only return yes/no results. I seem to remember that SQL had something like a least or most function that would allow me to set maximum value for range of days. I apologize that my question is confusing and hope you can understand what I am trying to accomplish. Thanks for any help
We want to send letters to clients on behalf of our salespeople on a weekly basis from a list of clients in a table. But some salespeople will have 5 letters go out and some will have 20 go out (depending on what amount the salesperson is able to followup on). I can store the weekly letter quantity number in the table no problem, but I am just not sure how to have the query show 5 letters for Bob and 20 letters for Sue. I know about the "Top N" setting in query design, but not sure how to set it to read from the table.
Form A is used for data entry into SampleTable. On this form I have a some fields including these two: ReplicateA, LabBatchCode.
The database contains another table, IndividualSampleTable. This table contains two fields: ReplicateB, LabBatchCodeReplicateB.
When the user enters information into Form A, the data in fields Sample.ReplicateA and Sample.LabBatchCode are used to populate IndividuallSampleTable. But here's the twist: On IndividualSample Table, IndividualSample.ReplicateB needs to be autogenerated (I guess). Then the field IndividualSample.LabBatchCodeReplicateB is comprised of LabBatchCode entered in Form A, concatenated to the IndividualSample.ReplicateB field.
To make it tricker, the number of records added to IndividualSample table is determined by the value supplied on Form A in the field ReplicateA.
So, Form A could look like this: ReplicateA: 3 LabBatchCode: CRBR05151998
IndividualSample table should end up with three records like this: ReplicateB: 1 LabBatchCode: CRBR051519981
ReplicateB: 2 LabBatchCode: CRBR051519982
ReplicateB: 3 LabBatchCode: CRBR051519983
Hope this makes sense! And I appreciate the help!!!!
While doing a rabbit DB for the missus I have hit a problem, if one of the does gives birth to 3 babies i wish to have the details entered onto a form (not a problem) but i would like to do this:
if number of babies = 3 then fields to display to enter details is 3 on the form, i have my table setup with up to 10 seperate field for the babies per record but am stuck trying to do this
I want my db to generate our reference # automatically based on input from other fields. The number is the date record entered, the users initials, and an incremental number. Ex. 120505GMM02
My form is based on a query and I have the query generating the first two components from the date entered in reqdate and the initials entered. How can I get an incremental number generated to go with the rest.
The number should start with 01 for each day and also for each user. Therefore when GMM is entering his third record on the 5th it should generate 120505GMM03 even if there were 10 other records entered on the fifth by other users. Each users numbers would start at 01 for each day.
I asked this earlier but thought I would restate my question in hopes of getting my thoughts around this. I appreciate your patience with me.
I'm having some difficulty obtaining the answers I want from my query. I'd have been more comfortable using filters in excel to find the answers, but my dataset is too large in this instance.
I devised a query which I thought should achieve the results, but based on a subset analysed in Excel the answers are significantly different.
My table has about thirty fields, the query I've produced is this: SELECT AH_orphans.Product, AH_orphans.Comments, AH_orphans.ESP, AH_orphans.[ESP Parts], <snip, all other fields in table> FROM AH_orphans WHERE (((AH_orphans.ESP)="n") AND ((AH_orphans.FRU)="y") AND ((AH_orphans.EntitlementName) Like "*uptime*") AND ((AH_orphans.Account) Like "nation*") AND ((AH_orphans.Type) Like "Primar*") AND ((AH_orphans.[Is a parent?])="#n/a")) OR (((AH_orphans.ESP) Is Null) AND ((AH_orphans.FRU) Is Null) AND ((AH_orphans.EntitlementName) Like "*uptime*") AND ((AH_orphans.Account) Like "nation*") AND ((AH_orphans.Type) Like "Primar*") AND ((AH_orphans.[Is a parent?])="#n/a"));
What I'm hoping for is the subset which match the following conditions: - ESP field is not "Y". Possible values Y, N, null - FRU field is not "N". Possible values Y, N, null - Only those records from EntitlementName which include the substring 'uptime' - Only those records from Account which start with the subtring nation - Only those records from Type which include the substring primar - Only those records from [Is a parent?] which equal #N/A.
Asking the same questions in Excel I get around 1.5k records. If I use the quoted query on the same dataset in Access I get precisely 11.
Thanks for reading this far! If anyone can spot the flaw/s in my query, or indeed advise that I'm going at it completely the wrong way I'd be very grateful of some advice.
I have an address database where people have been allowed to type in any characters they want in place of just leaving a missing field blank. For instance the Zip code was not a required field (don't as me why because I don't know. It just wasn't) so over the years when the person entering the data didn't know what the zip code was they would put a ?, a 0, a 000 or a period or what ever else they could think of at the time.
I would like to add a filter in my query where I could eliminate any thing with less then a certain amount of characters.
I thought something like this would do the trick
Zip: IIf(Len([V_ZIP]<5),[V_ZIP],"0")
But I am getting a data type mismatch in criteria expression. Any ideas of what I am doing wrong?
Im trying to print a report from a form. I want the report to have the contents of the forms current record.
The underlying table has an autonumber as it's index/primary key and it's this im referencing. What happens is a record is saved and the autonumber is generated.
DoCmd.OpenReport stDocName, acPreview, , Me.RefID.Value ' the value of the forms id box
= [RefId]' the value on the report
The problem i have is this:
when i ask it to return the record which shares the id number of the current form record i get a blank report with no error.
when i ask it to return the record equal to a specific record number - by swapping the varibale for a fixed value i get all records- can anyone suggets what is going on here?
I have a field called [Hours] If a user tries to change the [Hours] I need to check if any of these hours have been assigned to staff in another table.
How do I get to run the query and use the value from the result of the query as the Minimum value?
I would like to run sql and if the value is being entered into the [HOURS] field is less then show a message and do not change allow the value to change.
I am sure this can be done in VB but I am am unsure of the syntax
I have an excel data file that is updated monthly (and I am not able to have the source file format changed of course) that will be my linked table for Access 2007. The file reports monthly data and adds the new month to the right of the historic in a layout like this:
Tree | Orchard | Province | Jan % red | Jan % green | # Limbs | Feb % red | Feb % green... etc so each month it adds 3 new fields to the data.
I have queries (rightly or wrongly) that will calculate the number of apples that month and report on those higher than a certain percentage. I would like to do this without having to create a static table to append to each month as the new data file will always show the full YTD results anyway (and I don't like to store data in my database).
I have a query that counts the number of fields in the raw data file and am wondering if there is a way to have access only run the number of queries required based on the number of fields. i.e. if 11 fields then run queries 1 thru 5, if 14 run 1 thru 6 etc.
I have a table with an empty column called ActionID. I need to generate a numerical number that begins with 5000 and goes up by 1 number on each saved record. I have a basic form that links all of my other field to the table except the one I need to generate (ActionID) but will need that number saved to the table once its created.
I am looking for an elegant way to retrieve a number from a table and display it in a form, where the number is determined by two values that will be input by the user to the form.
In particular, I want to be able to enter into a form:
- a date; and - a class of asset
And have the relevant rate of depreciation for that asset class and that year appear in the form.
Sounds trivial and I guess it can be done in a number of ways. I have tried DLookup. It looks like it should work, but I have not been able to get the syntax such that it will accept a control value as a field name in the first argument of DLookup. (This would involve a table much like a spread sheet with a column for each year. I guess such tables are frowned upon and I have also heard negative comments about Lookups.)
I have experimented with concatenating the two fields into one such there is only one field to search upon. Seems to work. The table would only be updated annually and would only be a few thousand records.
I have experimented with having two joins between tables, but that did not seem ideal.
Perhaps a query of a query?
Perhaps a macro?
(Assuming I can get the form to work I would also like to create a report that lists assets and their depreciation.)
I wish to produce a delivery note which needs to print an empty box for manually ticking.
I need a box for each item quantity i.e 5 items on the job print 5 boxes. 20 items print 20 boxes.
I have been able to use very crude code if there is only a few items, using if qty =1 then / 1/ else if qty = 2 then / 1/ / 2 / etc etc ...
That works and prints the / 1 / 2 / which is ok but there must be a simpler way as it the job has more that it would be much better and far more useful for other reports to print a box or item.
I am looking for a way to use vb, or any other way, to allow my users to enter a railcar initial and then a number sequence and add new records to the end of the table.
For example in a form the user can enter the car initial and the number sequence Railcar initial: GATX Number sequence : 290001 - 290100
I would like a way to create a temp table that then has 100 records GATX 290001 GATX 290002 GATX 290003 etc etc.
I can then use this temp table in an append query to add them to my main table.
I need to make a query work so that when someone enters info into a master form, it will pull the data for that job onto other forms when the job # is entered. Thanks for any help.
I am importing data to a program that requires the life of an item. This is in months such as 241 months. The valid format for this program is YYMM. 241 = 2001 or 20 years 01 month.
Another example: 16 months should read 0104 or one year 4 months.
Any idea how to convert this to yymm format based on the number of months?
I've been searching all the forums and unable to find my answer. What I want to do is show on a form the average quote for the specific model number.
On the form there is customer info, product info, etc. I want to see the average of what we have quoted every other time we have seen this product (we do repairs). The identifer for the product is the model number, Model#, the quoted cost is PRICE. I've used this function before, DAvg("[Price]","Repairs","[Model#]='013003020'") - which of course gives me the average for one specific model number (013003020). How would I use a similar function but have it do the average for the model number that I am viewing on the form?
If I am able to do that - I also need to find a way to not include nulls and zeros from the Price field.
I have a table that contains many records of events. I've already created a multiple item form based on the table. My form contains 2 textboxes for input of a date range and a dropdown box to select "yes or no".
What I am having difficulty with is the query that will count the records by type insert it into the recordsource such that the multiple item form will appear like this:
Event Type| Count Input | 4 Output | 2 Update | 3
How do I go about doing so? I have been testing with this simple query:
Code: Private Sub Command8_Click() Dim Task As String
Task = "SELECT EventType, Count(EventType) FROM Final GROUP BY EventType;" Me.RecordSource = Task End Sub
But the column that contains the count keeps appearing as #name?
I search around online and did come across much info on code to how to hide fields. But, the problem is I cant seem to find a way to hide a certain amount of fields based on a number amount.
example: Lets say I have a 12 text fields to show 12 months of monthly payments, and lets say a client only has a 3 payment term. How can I list 3 under installment field and have remaining 9 fields auto hide since they wont be necessary? this way I only see what applies and not additional text fields.
I'm incrementing a counter every time I click on a combobox by using the on click event and this code:
Code: POcount = POcount + 1
I have 5 fields on my form: GWS1, GWS2, GWS3, GWS4 and GWS5.I want to store the value of the combobox when clicked into the correct GWS field. For example: If I click the combobox 3 times it would store the value of the combobox after the 1st click in GWS1, after the 2nd click in GWS2 after the 3rd click in GWS3.I tried
I have a table called StockTable with the following fields Location, Status, Serial, Make, Model, LastDate, DotNumber
I also have a table called FCDateRange with three fields
DateStart DateEnd and DotNumber
For example
3/7/13 - 3/13/13 - 1 3/14/13 - 3/20/13 - 2
Im trying to figure how to write a query that if the lastdate from the StockTable falls during the DateStart and DateEnd fields it will assign it the number in the DotNumber field