hai brian.zaballa don't forget change your fiter datetimpicker2 to < =
Thank you for pointing that out. I have overlooked it after copy-paste. LoL
My Visual Database → Posts by brian.zaballa
hai brian.zaballa don't forget change your fiter datetimpicker2 to < =
Thank you for pointing that out. I have overlooked it after copy-paste. LoL
Thank you again brain. How did you populate table? You did not make any change on income statement. I still could not understand about a and b.
I didn't make any changes on income statement.
The populating of data occur on the onClick method of No_Sales_2 Button.
It's like Insert into qtable with the (Select query I copied on No_Sales Query)
qtable columns is the same count and sequence on its corresponding data in the select query for it to execute properly.
Here. I made a sample. just add whatever filter you want there.
Thank you brain.This project is going to be interesting. I want to know to how a checkbox can enter in querry conditional part and how can we display record for specific period
Simplest way that I can think of is to have another table and populate it of the records whenever you are going to access it. Filtering will be easy in that manner.
Double pipe || means concatenate. It is sqlite syntax. Its counterpart on mysql is concat().
Calculated field is just like a subquery. It's like a temporary field that is another query or sum, difference of multiple fields, and so on.
Try to learn a little bit on SQL queries for you to understand more about it. As ehwagner said, sqlite and mysql are much alike for they are both SQL. There are only some difference b/w them such as that concat I said above, LPAD, RPAD which is only available in mysql, and so on.
Here. I made some changes too. I point again the table from Sales_Ticket Form to Sales_Ticket table. It must not be pointing to sales. I added a detailed tablegrid for the sales table. Sales_Ticket table must be pointing to Sales_Ticket for the edit button to function. I also deleted Total Field on Sales_Ticket, you won't be needing it for you already have sTotal field
Thank you brain. Would you like to tell which kind of changes be made in project structure? My other question is: it is possible select clause from one table and conditional from amother table? What will be syntax and how it will work
There's no need for a change in project structure. It's just that we need the desired output you want and someone will help you with it. I don't have a case to give as a sample. You can state a problem to which that conditional from other table is needed, then we'll solve it and create a query with it.
Thank you brain to reply. I am really sorry you still could not understand what I am asking. I want to know how to add field from other table to quarry? For example sTotal from Sales_Ticket to No_Sales quarry. How it will be done. This is for practice. I know this project is working very well.
You can just copy the whole text from the calculated sTotal and paste it to where you want to use it. But you need to consider the relationship and to where you are trying to access or include it. In the case you want, as I've said, you don't need and it is not possible to add sTotal to No_Sales query because of the structure of your database. You have to look for other example and scenario for practicing.
Here. I added total count on No_Sales Form query. Maybe it'll give you an idea
Hi brain,
Infact I want to know how to add field from other table with same condition. Just like I typed before
Sorry, still not getting what field you want to add and to where.
Are you referring to the query on No_Sales form? It's working fine for me. You don't have to add or include Sales_Ticket there for it is already getting the total sales grouped by date from sales table and not by ticket.
Hi brain
Look attached project by endanger. From Sales_Ticket table, I want to add sTotal field in Sal quarry on farm. No_Sales quarry button. How it will be?
Sales_ticket already had sTotal calculated field in it. I just update the TableGrid on Sales_Ticket Form for it is pointing to sales table. It has to be on Sales_Ticket for it to display correctly.
Thank you endanger to guide. You gave much more information. My another issue is how can we add a field from another table? Or we can add field from one table? Can you guide?
Yes you can. Can you elaborate what field/s you want to add and to where?
It's something like
( tbl1.field1 + (SELECT somefieldon_tbl2 FROM tbl2 WHERE tbl2.id_tbl1=tbl1.id) )
or something like
( tbl1.field1 + (SELECT TOTAL(somefieldon_tbl2) FROM tbl2 WHERE tbl2.id_tbl1=tbl1.id) )
It'll depend on what data you are trying to get or obtain.
try changing
form1.tablegrid1.SelectedRow := vr;
to
form1.tablegrid1.Row[vr].Selected := True;
and see if that's what you want to do.
Here's a sample.
Thank you ehwagner. It is really good solution which I wanted but it created confusion. Confusion is from where a.sdate, b.sdate, b.id_Category , sales a, sales b fields come? No in any table?
It is a syntax of SQL. It's like naming sales to a then sales to b
a and b both point to Sales table but the query consider it like a different tables.
The query basically get the distinct record of a by date, then subquery the number of record per category from b grouped by sales date from a
seems ok. try
frmHousing.hPurchaseDate.Visible := (frmHousing.cboRentOwn.Text = "Own");
I can't comprehend what you really want to do but it is attainable in my perception. We just need a little bit more details on your table and to where do you execute that queries. As derek said, it is better for you to upload at least part of your program if you can't upload all of it. Just have copy of the form and tables to where you want to execute that queries in a new project.
Use LinkFile, then use CopyTo to save the copy on your application folder
You can set CopyTo to blank if you only want to point on the current location of the file.
Thanks, Brian,
I can convert my access database (.accdb) to excel worksheet (.xlsx).
Is it possible in this case to search, add, edit or delete records using MVD ?
I think the best way is to convert it into sqlite. Then you can use all MVD's feature. search, add, edit, delete, etc.
You can use 3rd party software to migrate your data. In my case, I use Navicat. It's a paid software but you can use the 14-day free fully functional trial. You can directly export data from .accdb to sqlite from there. If you are working with .mdb, you can export it to excel, then from excel, you can export it to sqlite using Navicat. There's a lot of 3rd party database viewer. DB Browser is a free tool, I think you can export csv data using it.
Here's a simple implementation
Hello,
I have almost generated the desired report using Report(Sql) option. I'm stuck at one point. I want to include the Select_Eye for the Complaints also. But since Select_Eye is a foreign key to both aa_004_clinics and aa_003_complaints, there appears an error message "ambiguous Select_Eye...".How can the eye of complaint and diagnosis be selected? Do I need separate lookup tables for Complaint_Eye and Diagnosis_Eye?
Regards,
Eyeman
I don't have time to check on the details but for the Report SQL, all you have to do to avoid that ambiguous error is to explicitly select each Select_Eye with their corresponding Table. Here's a sample to join lu_004_Select_Eye named as CE and then explicitly select the two Select_Eye Fields that is in same table lu_004_Select_Eye but in different name(CE and E) and joined to separate table clinic and complaints. Hope this gives you an idea
SELECT
V.id, OPD_ID, Date,
First_Name,Last_Name, PID ,
doctor, complaints ,diagnosis , E.Select_Eye as SE_Diagnosis, CE.Select_Eye as SE_Complaints
FROM
aa_002_opd_visits V
INNER JOIN
aa_001_patients P ON V.id_aa_001_patients = P.id
INNER JOIN
lu_001_doctors D ON V.id_lu_001_doctors = D.id
INNER JOIN
aa_004_clinics C ON C.id_aa_002_opd_visits = V.id
INNER JOIN
lu_003_diagnosis G ON G.id = C.id_lu_003_diagnosis
INNER JOIN
lu_004_Select_Eye E ON E.id = C.id_lu_004_Select_Eye
INNER JOIN
aa_003_complaints M ON M.id_aa_002_opd_visits = V.id
INNER JOIN
lu_004_Select_Eye CE ON CE.id=M.id_lu_004_Select_Eye
INNER JOIN
lu_002_complaints LM ON LM.id = M.id_lu_002_complaints
where
V.id = $id
Hi, Brian,
I have something similar: an Access database with several columns and lot of records (rows) and nothing else.
I want to search, add, edit or delete records using MVD.
Can you (or someone else) set a simple example?
Thanks in advance.
Unfortunately, MS-Access Database is not yet supported in MVD.
Implementing an add, edit, delete will require additional script coding here in MVD. I hope MVD DevTeam will add it the future tho. For now, here's a sample. I only implement display and add functionality to give you an idea.
Just declare it globally
Check for problem in your code. You might have a transaction or query that is running in background.
Or you might have opened your database in a third-party database viewer.
Try looking for -journal file alongside of your database and delete it. If error still occur. keep looking for code problem
My Visual Database → Posts by brian.zaballa
Powered by PunBB, supported by Informer Technologies, Inc.
Theme Hydrogen by Kushi