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.
Related
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
Ah! I think I figured out part of the problem. I am trying to add a new Line Item by using the PartNumber to control the data in the Line Item. This won't work because I use PartNumber as the Primary Key in tblPartData; so it won't let me add an new Line Item because of a Key Violation in tblPartData. What I really need to do is change the FKInvoiceNum.
Basically I built my queries wrong and got confused. So I've just spent about 10 hours banging my head against this. When what I should have done was just written down a describe the problem, and then think about that for awhile. You know step back and look at it from a different angle.
Thanks for providing me a venue where I had to describe my problem succinctly for others. But next time I'll write up my question then let it sit for a couple of hours; to save you all some time.
I have an Access Database with a Form and a Subform for an invoicing system based on queries to the following tables:
tblInvoiceData (InvoiceNum, FKCustomerID, InvoiceDate)
tblCustomerData (CustomerID, all data pertaining to the customer -- sorry there are about 20 fields)
tblLineItemData (FKInvoiceNum, FKPartNum)
tblPartData (PartNumber, PartDescription, FKManufacturerID)
qryInvoiceExpandedData (InvoiceNum, FKCustomerID, InvoiceDate, CustomerID, and all the Customer data fields)
qryLineItemExpandedData (FKInvoiceNum, FKPartNum, PartNumber, PartDescription, FKManufacturerID, and all the manufacturer data fields)
The Main form is frmInvoiceDetails and is based on qryInvoiceExpandedData. The Subform is frmLineItemDetail and is based on qryLineItemExpandedData (includes the following fields: FKInvoiceNum, FKPartNum, PartNumber, PartDescription, FKManufacturerID, ManufacturerID, ManufacturerName) as a continues form.
The problem is that in edit or creation mode I can not change any Line Item Data, or add new Line Items. Can anyone show me where my mistake; I need to be able to change the Line Item Data in the form and can't figure it out.
Apologies if this question type was answered else where, I was unable to find it -- I expect I'm not asking the right question of the search field.
I have:
a table with user names
a table indicating actions with columns for user name, action time, action name. Named events unique_events
I started collecting data on January. I want to have a column in my table of user names which indicates how long it has been since a user first used my application and the first of January.
So if a user first logged in in January, the value of the row with that user's name will be 0. If one logged in on March it will be 2.
I tried:
Column = DATEDIFF(01-01-2016, MIN(SELECTCOLUMNS(FILTER('events unique_events','events unique_events'[User Name] = Users[User Name]),"DatedTime", [DatedTime])),MONTH)
which returns an error saying the Min function needs a column reference.
I also tried the same with FirstDate instead of MIN which returned an error saying FirstDate can't be used with summarize functions.
Any other ideas on how to achieve this, or fix what I tried?
(for simplicity, I will call your table 'Events', and user login dates field 'User_Login_Date').
First, define your app start date as a measure:
App_Start_Date:= DATE(2016, 1, 1)
Then, define measure that finds min differences between Application Start Date and User Login dates:
User_Start_Diff=: MINX(Events, DATEDIFF([App_Start_Date], Events[User_Login_Date], Month))
Drop this measure into a pivot table against user names, and you should have your desired result.
How it works:
1) MINX goes record by record and calculates date differences for each customer login. It then finds minimum in the results;
2) When you drop the measure into a pivot table, it splits MINX results by customer, and recalculates min for each of them separately. You don't need to do the grouping.
Creation of [Start_Date] measure is not technically necessary but a matter of good style - don't hardcode values in your formulas, always create measures. You will thank yourself later when you need to make a change.
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.
Magento database name convention is not trivial. How to get these fields below for last 7 days?
Last Name
First Name
Address
City
State
Zip
Phone
Email
Amount
Order #
Item #
I could not tell if you were looking for some PHP/Magento code or if you are looking to access the database directly. It might be "better" to create yourself a custom module that fetches this info using the Magento/Zend framework, but since I don't know the code off the top of my head I'll redirect you to the following link which has a very nice SQL query that will pull that info for you (and more).
http://www.magentocommerce.com/wiki/groups/207/fedex_-_shipping_view
You probably just need to add something like this to the end to filter the last 7 days
where so.created_at > NOW() - INTERVAL 7 DAY