18. september 2005 - 17:15Der er
11 kommentarer og 1 løsning
Transform a question into code
In creating a new record in a table I have several hidden forms, from which I collect data. Now I want to minimize the nbr of forms and collect the data through code. In one example the datasource is: SELECT NZ(Sum(Resapost.TAXAMETERBELOPP),0) AS SummaförTAXAMETERBELOPP FROM Resapost WHERE (((Resapost.SlutDat) Between Forms.PassOverfor1.Startdat And Forms.PassOverfor1.Slutdat) And ((Resapost.TAXINR)=Forms.PassOverfor1.TAXINR) And ((Resapost.ARBPASSNR)=Forms.PassOverfor1.ARBPASSNR) And ((Resapost.KREDITTYP)=999));. How should the code be written to give the same?
After importing data to two different tables, Pass and Resapost, I will lookup info from thees tables and create records in another table, Grund. To one record in Pass there are several records in Resapost which are detalj information obout the record in Pass. I have to combine these two to get the complete information. The same info in both tables are Taxinr, Arbpassnr, Forarid. This is the identification of a specific taxicar, the id of the shift and the id of the driver. In Pass I get the date and time of the shifts beginning and end and the total income from the shift. In Resapost I have detalj info about each and every receipt from the terminal in the car. One of the problems is that there is'nt one exclusive id of a shift. A shift from two different cars can have the same id. Due to this, Taxinr, Arbpassnr and Forarid must be the same in both tables to be absolute sure that I do'nt get false data. In the table Grund I'm creating new shift info with a summary of the detalj info from Resapost. I should also metion that in Resapost the date and time is for the beginning and end of eath and every receipt, but in Pass it is when the driver loged on and out from the shift. To gather the info I'm now using several hidden forms from which I'm collecting data to the form attached to the table Grund. There You have the background.
add both the tables to a query and just join the fields using drag and drop. This will give you an INNER JOIN which means that there must be information from BOTH tables before they are shown in the result.
The hidden forms I'm using works as questions and the result is transfered from these forms to one form. I would like to get the same info without opening the hidden forms. Creating the new records in the table Grund is done automaticly from a button on the form attached to Grund. This process is, I belive, is unneccessary slow since several hidden forms has to open and then close after the data of one shift is collected. Then opend again for the next shift and so on. I think there must be an easier way to go.
I think its going to be necessary to see the dB so that I fully understand your requirement. If you can send it with an explanation as to how thing currently work then perhaps I can make some suggestins. I'll take a look this evening, busy right now :o)
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.