I'm currently working on an Inventory Control db that allows tracking stock transactions from one location to another but, I can't figure out how to create 2 records simultaneously on a "Transactions" Table based on the same data.
Basically, I'd like to create a form where I enter Item, Qty, From Location, To Location, Lot and have 2 records created simultaneously with a negative qty on the "From Location Record" and a Positive Qty on the "To Location Record".
I've attached a screenshot of the Form I envision and the desired Output in Data Records.
I have some experience working with Access forms and tables but this development is beyond my knowledge.
I Hope someone can help.
Thanks!
Form & Table screenshot
You would run couple of simple insert queries. One to move the stock out from the existing location, one to add it back to the new location.
If you are not well versed with writing VBA I would use the query designer, and include your form text boxes as the criteria. Save the queries, then use your button to run the queries one after the other.
I would also be tempted to bring in the existing location as a combo box based on the part number selected. That way you won't try and move something from a location that isn't correct,
Related
Picture of my relevant fields simplified for this example:
I am currently working on updating a database in Access for work that has more or less been just a spreadsheet up to this point. As such, I have a lot of information stored on a single table and I'm looking to avoid creating new tables that have to be manually filled in if possible. I track our purchases, confirming whether or not all the items on a particular purchase order or "PO" has come in, or if that PO only came in with a partial shipment. This database does not track POs as they are created, only as they are received by shipping, so I do not have a separate table that lists all the POs.
I am trying to create checkboxes in my table that synchronize with other checkboxes of the same PO, so when I receive the final shipment in for a PO, I can click "Order Complete?" (see linked image above) and all of the checkboxes with that same PO# will also be selected.
So far, in my fairly limited Access knowledge, I have attempted to make a new table from a query that listed only shipments with PO#s and then removed duplicate PO#s. I put the same "Order Complete?" field in the new table and then linked the PO# field on both tables and the Order Complete? field on both tables, but this didn't match them up. My coding knowledge is fairly limited and a little rusty so I was wondering if there was any simple way to do this without a really deep dive into coding.
I am constructing a MySQL Database with the end goal of creating a GUI CRUD frontend in Microsoft Access. In the attached picture is the layout for the contacts section of this database. [Current table relationships]
Ideally, all of the tables in this screenshot (barring payments) would be populated in one Access form, but I'm having trouble working out a way to make this happen. The most obvious answer (with my limited SQL knowledge) is to create a massive view connecting all of these tables, and then have the Access form call a stored procedure (either one massive SP, or one for each field? Not clear on this) to C/R/U/D the view.
I tested out creating a view with a few tables (one many-to-many relationship and one one-to-many) below:
CREATE
ALGORITHM = UNDEFINED
DEFINER = lauren3#%
SQL SECURITY DEFINER
VIEW peopleformview AS
SELECT
p.PersonID AS personid,
p.Title AS title,
p.FirstName AS firstname,
p.LastName AS lastname,
p.Role AS role,
p.DOB AS dob,
p.PassportNum AS passportnum,
p.Alumni AS alumni,
p.Degree AS degree,
p.Nickname AS nickname,
p.Email AS email,
p.PermissiontoEmail AS permissiontoemail,
ar.agent AS agent,
a.AddressID AS AddressID,
a.Address1 AS Address1,
a.Address2 AS Address2,
a.City AS City,
a.State_Province AS State_Province,
a.PostCode AS PostCode,
a.Country AS Country
FROM
(((people p
LEFT JOIN agentref ar ON ((p.agentref_agentid = ar.agentid)))
LEFT JOIN people_has_addresses pha ON ((pha.people_PersonID = p.PersonID)))
LEFT JOIN addresses a ON ((pha.addresses_AddressID = a.AddressID)))
Am I on the right track here? It seems that such a view would get unweidly quickly.
Be it the desktop, the web or just about any platform?
You model and display and edit relational data by cobbling together parts that are based on the relationships.
But, you actually base each part directly on a single table. You don’t create a view server side to join all that data together. And you don't use SQL either.
If you have one customer, and 30 invoices, then if you join the tables, then the customer will appear 30 times. You can’t possible edit such a mess as one data row.
So this would be the related tables:
So, in the case of access, you would build a form that edits the main customer. Such a form lets you edit one customer at a time. Build that one form – get it working all nice.
Again, above is based on one linked table.
Now, to display the invoices for the one customer? Ok, now build a new form (multiple items form). And you base this form on the invoices table.
Once you build the two forms? Well, open up your main customer form in design mode, and now simply drag + drop in the invoices form from the nave pane.
So, you wind up with a screen like this:
You can see the main form has things like customer name, address etc.
And the other form (a sub form) shows the list of invoices you have for this one customer.
The beauty of Access is it will connect up the main form, and the sub form for you, and do so without code. So, each main customer record you navigate to will now show the child related records in that sub form. You do this by setting the link master and child settings in the sub form control:
Now, of course each invoice will have a “main” invoice part. (Date, customer, maybe billing address). And for each invoice, you will have a child table of invoice details. (Quantity, item, price amount etc. for each thing in that one invoice). So once again, the above simple concept is repeated for this invoice form, and the child form of “invoice details”.
So, in above when I click on an invoice, we simply open up a main invoice form to the ONE invoice record, and the child invoice details is again displayed as a sub form. Like this:
So, be this desktop development, or even web development?
You create a user interface based on dropping parts into a form that are each based on a single table.
So each part that displays records as a general rule will be based on a SINGLE table. You thus as a result for such data editing will NEVER use a view or data joined together for editing.
And with Access you not use any sql either.
Each bit and part you used to edit data will be directly based on ONE single linked table in access and not some view.
As a result, you don’t need views, and you don’t even need sql for each part you build.
The ability to edit relational data will thus be based on how you cobble together each bit and part, but each of those parts are NOT going to be based on some sql query, and in fact not based on a view either. Each of the parts you use will be based directly on a linked table, and a single table at that.
Each part you use here ONLY ever edits ONE record at time. Read that last sentence 10 times to ensure you grasp this simple rule.
So, you can certainly get creative. So, here is an example form that shows 3 tables all at the same time. IN this example, we have an event, a then people and their donation for the event. And we need to split out the donation into different accounts. Someone might give $50, but 10 is for funerals, and the other $40 might be for the school.
The top part is the donation event (one record). ON the left side is a continues form that shows the people that donated to the event, and their amount. And on the right side we show the accounts for a single donation we selected on the left side. Each donation can be split out into multiple accounts.
This is a common and “classic” accounting type screen in which you enter a given amount, but split it out and apply it into multiple accounts.
And again, the above Access form is not based on views or even sql queries, but each part we placed into the form is based a single linked table.
So it is the slicing and dicing of bits and parts that you place into a form that allows and gives you the ability to edit related data, but each part is only based on a single table out of your elated data model.
It is “how” you cobble together these bits and parts that allows the magic of editing of related data. As such, this process and thinking on your part has really very little to do with building views that join together related data. In all of the above examples, I did not write any sql or create any views, and each part was simply based directly on a linked table, and not even some sql. So your related data model is a “guide” and will give you information as to what table and part comes next in building your user interface.
I'm pretty new to Access and coding in general and I've been working on a database that was filled with data extracted from SAP.
I have a query that works as a way to "summarize" the information of a bunch of records from some purchase orders, it does sum the total of each PO, it's date as well as other information. It does consolidate a variety of items related to the purchase order into a single record that is displayed in a continuous subform for easy analysis in this structure.
[MES_CORTE][SOLPED][PO][FirstMIGO][TOTALPOVALUE]
This way, the user can preview easily each purchase order, date, value and other relevant information. This query is also used to generate some reports.
However, I want to be able of opening the source table ([Registro_OC]) and search the related records by clicking a field on the subform for a detailed view and posibly to edit or enter new data. is it posible?
I've tried to code some macros but can't figure out how to reference the table fields related to the query fields that are on the form.
Also, it seems that Access doesn't allow to create subforms based on continous forms.
Any help and opinions are appreciated.
What is the best way to organize a big database.
The way it works is that only I am allowed to touch or modify the database but interns help sometimes to collect data, we used to have the whole system excel based, back than we had the macro which by choosing 2 files it will integrate and mark in colors the changes.
How can I create something friendly to use which will update by pressing a button and also will show changes!! I am familiar with the update query, however:
it doesn’t track any changes.
I want to know other options.
To sum up the way of processing is:
I have the database and I need to split some data to smaller files so other employees will work on.
Then I will collect the files and integrate with the existing database, but since we are all human mistakes can happened that’s why I want to be able to track easily changes.
The updates are going to happen often. When I will give the intern a temp. table The possible changes are for example: address, phone number, price, they will do those researches based on current data which they will find online which information has been changed, and they will change the info which is on the temp. table, That is why I want to be able to know what exactly did they found out. Lets say if Product A (product ID1234) used to cost 10$ and today its 12$ from the same supplier. I just want to know and to see that the price for product ID1234 has been changed. Not only to have it updated to the back end database. For quality assurance I need to track which new input they did in relation to the product ID. (some times input by someone else which was done in wrong format or wrong column could affect big time on the quality of the reports)
So this was the explanation for what I need the reports
So in order to make those temp. tables, I want to create a form for it that by choosing region, category etc. and then clicking on a button it will automatically select the relevant records from the database, create a new table/access-file and then copy the selected records to the temp. table. So someone else could work on it...
Next thing is that it would be nice to know how can I create a template for tables, by template I mean to standardize by validation rules. some fields I'd like to have dropbox menu, some fields ready mask for phone number.... etc.
Final part, after they made the changes and saved the file (the temp. table which they were working on), I want to be able to update the back-end database via clicking on a button...
Looking forward to get the best solution!
Thanks in advance J
Michael
Okay for the temp tables thing:
why not split your database in a backend part (having all the tables) and a frontend part which contain the forms and tables the interns need? I'm guessing mostly it is going to be the same so you can even create multiple different frontend's to give to different interns incase they need other tables. There are a lot of articles out there about splitting a database and linking tables.
Then the thing about the record changes not sure is this is what your looking for but it could help, i haven't used it myself so not sure what it exacly does. But this may help you a bit.
http://support.microsoft.com/kb/197592
I would consider taking a look at the BeforeUpdate event for the form. You can trap the old and new values of textboxes if the form is bound to a table. You could loop through all the controls on your form and check for Me.Control <> Me.Control.OldValue. If they don't match, write both values to an auditing table so you can go back and check whenever you want to. I would include the following fields in your auditing table:
ChangeDate
TableName
ControlName
OldValue
NewValue
Then you can query that table any time you want to see what has changed.
I'm trying to make access conditionally only show rows that meet a certain condition, allow me to give you some background info before I proceed :
I've created an Access form and linked it to a test DB on my machine. The particular table I am interested in contains the following (important) rows :
ID , Office, Name, SecurityNumber
The thing is, ID is not unique. There are two Office locations, and each Office has it's own set of unique ID numbers. This means that ID 10 here and there may or may not be the same person. (this data comes out of a legacy security system we're not looking to change yet, so I cannot change it)
But ID -is- unique to each Office.
SO! I created an Access form with TABS! Two tabs, one for each office. What I am trying to achieve now is :
Have the ID/Name/SecurityNumber fields for each tab populate with only rows that match it's particular 'Office' value.
Thank you for reading and thank you for helping! :D
If you want the data for the office locations presented in separate tab page controls, you could use subforms on the pages which differ only in the WHERE clause of the queries used as their record sources. So for the Office1 subform, the query could be:
SELECT ID, Office, [Name], SecurityNumber
FROM YourTable
WHERE Office = 'Office1'
ORDER BY [Name];
Then for Office2, the query would be the same except for the WHERE clause:
WHERE Office = 'Office2'
As I understand your question, that approach would do what you're asking for.
However, that's not really the easy "Access way" to do it. Instead consider a combo box control to allow your users to choose which office they want to view. In the code for the combo's after update event, either modify the SELECT statement used as the form's record source or create a filter expression an apply it.
Also, since you're pulling the form's data from SQL Server, consider whether you want your form to load every record for the selected office location. It may not be much concern if you have only a few to moderate number of rows for each location, but if you'll be dealing with multiple thousands of rows it could be. In general, you should try to avoid pulling copious amounts of data across the wire; pull sparingly instead ... only what you need for the immediate task at hand.