Automatically calculate a value in Microsoft Access after user input - database

I made an Acces database where the user can enter the client name, the price he has to pay, etc. (it is a payment management database).
I want to make it so when the user inputs the price, it automatically puts (in another field) the price, but calculates the price + VAT.
How can I do this? Or Is this even possible?
Thank you in advance!

For that other field, use a ControlSource like:
=[Price]*(1+[VAT])
or, to avoid error for empty fields:
=Nz([Price])*(1+Nz([VAT]))

Related

Salesforce Service Cloud - Table Account NULL values

I'm trying to obtain data from Service Cloud Salesforce but when I select the table in SSMS, the data is all NULL, so probably I'm not specifying the right columns or table.
Salesforce Report Builder
Salesforce Source Editor (Visual Studio)
When I run the report in Salesforce I can see that the country and postal code data are filled in, but when I read the documentation, I don't find the main column "Country" neither "Mailing Zip/Postal Code".
For the Zip Code, in this example, since it's also filled in the data about Billing Postal Code, this one I could obtain in the extraction, but for the country I can't find a column named "country", only "BillingCountry" and "ShippingCountry", but these columns do not contain any information.
Documentation:
https://developer.salesforce.com/docs/atlas.en-us.234.0.object_reference.meta/object_reference/sforce_api_objects_account.htm
Can anyone help here? I need to add on the select in salesforce source editor (visual studio) the right column names to obtain the country and the zip code.
Thank you,
Your report mixes fields from Account and Contact joined together by Contact.AccountId = Account.Id. You could edit it and expand the left sidebar to see which field comes from which object.
Account has Billing and Shipping address (2 sets of fields with actual names becoming BillingCity, BillingStreet... And Contact has Mailing address and Other Address.
So that's 4 * 6 fields across 2 tables out of the box. Can be muddied up further if you have "Person Accounts" enabled (some contacts get paired up as 1:1 relation to account instead of 1:n, in something that behaves a bit like materialised view for MS SQL people?). Also admin could rename one of the fields (API Names of columns stay the same but you'd see different labels in report and UI), add custom address fields...
See how these queries work for you. Try them out in Salesforce Developer Console (in web UI), or VSCode first, not in that tool you have.
Pure contacts
SELECT Id, FirstName, LastName, MailingStreet, MailingCity, MailingPostalCode
FROM Contact
WHERE MailingPostalCode = '4465-613'
LIMIT 10
Pure accounts
SELECT Id, Name, BillingStreet, BillingCity, BillingPostalCode
FROM Contact
WHERE BillingPostalCode = '4465-613'
LIMIT 10
Now JOIN (for normal Salesforce, B2B, where Account is more like a company and Contact is more like employee)
SELECT Id, FirstName, LastName, MailingStreet, MailingCity, MailingPostalCode, Account.Name, Account.City
FROM Contact
WHERE MailingPostalCode = '4465-613' AND Account.BillingPostalCode = '4465-613'
LIMIT 10
And since your second screenshot looks like you do have person accounts (more like B2C model, with standalone "1 man companies" like freelancers, doctors working in multiple hospitals, students in education...) try this one too
SELECT Id, Name, BillingCity, BillingPostalCode, ShippingCity, ShippingPostalCode, PersonMailingCity, PersonMailingPostalCode, PersonOtherCity, PersonOtherPostalCode
FROM Account
WHERE IsPersonAccount = true
LIMIT 10

How can I update or change cost price (standard price) in odoo v13 postgresql database?

I am trying to change the cost price of products in Odoov13 in postgresql database, can anyone please support me with an example or guide? The question is simple, there is a selling price and a cost price (standard price) on the products, I just try to change the cost price, not the selling price, but I don't know how to get to the table or column, the Only reference I have is that the value can be stored in property field, but I don't know how to access it.
SELECT * FROM ir_property WHERE name = 'standard_price';
Fini
The field standard_price is computed field without store=True So it can store the data into postgres database.
If you want to update the field value, You can make the server-action following step:
Goto Settings->Server Actions
Model : Product Template
Action To Do: Update the Record
Data to Write:
Field : Cost (product.template)
Evaluation Type: Value
Value: Add your value example, 112
make the Create Contextual Action
Goto Product template and refresh the page on the action you can find the created server action and execute.

how to pre-fill some parts of an access form?

New here, so be gentle with me. - edited to simplify
I'm trying to set up something in Access where:
user selects driver name and date
query finds stops along the driver's route
form opens with route stops (location details) filled in and user can add additional information (item picked up, weight of item)
all information gets transferred to a "Pickups" table, which has data on what was picked up, the weight, where (route stop) and by whom (driver).
I have stores A through H, and three drivers, Bob, Tom, and Jill. Bob’s route is stores A,B,C,D. Tom’s route is stores A,C,G,H, and Jill’s route is stores D,E,F,G. (I can't give real names/locations - work is very strict about privacy issues!)
Behind these are “Driver” Table, with driver name, ID, and truck info; and “Store” Table, with store name (A-H), address, phone number, and contact person.
We’re collecting all of the information about items picked up at each store into a “Pickup” table, with Fields: Date, Driver, Store, WeightOfFurniture, WeightOfBooks, WeightOfClothes
The user starts with the driver’s name and date, clicks a button, and this opens a form with the following fields:
Driver, Date, Store, WeightOfFurniture, WeightOfBooks, WeightOfClothes
with driver and date filled in based on the initial entry, and “Store” having all listings for a given driver’s route. So I select Bob and a date (11-12) and get a form with:
Name Date Store WtFurn WtBooks WtClothes
Bob 11-12 A
Bob 11-12 B
Bob 11-12 C
Bob 11-12 D
I can get the above information from a query without any problem, but I can't figure out how to (partially) fill the form with the query results (there will be multiple query results for a given route, so DLookup is not useful).
I think recordsets might be a way to go, but not sure how to do this. I'm very new at VBA, but am learning (the hard way!).
Any suggestions?
Thanks!
Use an INSERT INTO action query to insert those records into your Pickup table.
I can get the above information from a query without any problem,
This query is the SELECT FROM part for the INSERT query.
Then open your Pickup form, filtered for Driver, Date and Store that you just inserted.

MS Access: Search through Table for the same part of the String

I am trying to loop through Column Values inside my Table.
I have a register form, which provides the user with UNIQUE ID, based uppon his information.
For example:
Country = Austria
Each user that selects country Austria will get some sort of Unique Value for that match (lets say 00).
Account ID look like this:
XXXX00UNIQUECODE
Each country has it´s own unique value: (AT = 00, DE = 01, etc)
Now, I want to generate a UNIQUE CODE for each user, that will be just an increment (+1) value of the previous UC value stored in the table, for the same country!
In order to do that, I need to somehow loop through the Column, where the Account IDs are stored and search for the match.
The thing is, when a user tries to generate the UNIQUE CODE, he does not have it yet, so he has only:
XXXX00
Now I need to find all the XXXX00 strings in my AccountID Column, and store them in an Array - then find the Max Value of those and increment it.
BUT I dont know how to search for a part of the string inside a Column of the Table ?
Just the XXXX00 part, not the entire Account ID XXXX00UNIQUECODE.
Agh, I hope you can understand me. It´s quite complicated I know, but I´m really stuck here. Hopefully, someone will know what I mean and maybe even find a smoother solutions for this.
Thanks in advance!
You're pounding a square peg into a round hole. Why not just create a new column called UserID and then you can do:
SELECT Max(UserID) FROM MyTable WHERE Mid(AccountID, 5, 2) = "00"
and increment it by 1.
Better yet, store CountryCode, UserID and the XXXX part in separate fields, and index them. It'll save time when you search or filter, which I'm assume you're going to be doing.

MS Access Age Calculation across tables

I'm editing a database template so I can track differences in patient tests across age for the same person.
I retro-fit the "Student Database" template to utilize the forms and macros already created.
I have a patient table that stores all data collected at initial intake : name, date of birth (DOB), etc. and a second table that would track test scores across visits that includes : name, date of visit (DOV) and score information. These are paired so I can pull up information from one patient and see their scores across visits.
What I need to do now is create a query where I can calculate their age when they took the tests.
To do so, I have used expression builder and entered Calculated:([Visit Date]-[DOB])/365
This works for calculating age only if I re-enter the DOB in a new column on the patient visit table
I've tried using DateDiff and using [Patient]![DOB] to recall the data from the other table but I get the same error.
(Calculated age: ([Patient Visit]![Visit Date]-[Patients]![DOB])/365)
Calculated age: (DateDiff("yyyy",[Patients]![DOB],[Patient Visit]![Visit Date]))
Both spit out the error : Enter Parameter Value 'Patients!DOB'
If I enter a date, all data points and patients calculated to have the same DOB that I entered.
How do I let Access know I need it to calculate the date at visit for the DOB of the same patient?
?: Do I need to create a lookup table for the patient ID to match with the DOB and then use that field for calculation?
If there is something wrong with the expression I can fix, that would be ideal. If not, what is the best way to calculate age at visit without having to manually enter in the patient DOB more than once (once in initial uptake and again at each visit).
Thank you in advance.
I found a solution!
I was using 'query' wrong. instead of trying to force it to recognize another table, I needed to add the table to the query upon query creation.
i.e.:
1_ selected 'Query Design'
2_ selected the tables with the required information (entered through forms)
3_ Used `
Patient Name: IIf(IsNull([Last Name]),IIf(IsNull([First Name]),[First Name]),IIf(IsNull([First Name]),[Last Name],[First Name] & " " & [Last Name]))
`
for the first field and
Patient Visit.*
for the second field. By adding "Patient Visit.*" the query will add all fields from the table into the query.
The third field I selected DOB from the Patients table (it was available for selection because I had the two tables selected in the layout initially).
I am now able to use the original
Calculated:([Visit Date]-[DOB])/365
for age calculation w/o any error. I finalized formatting under properties > format > fixed.
Wooo!

Resources