Link to home
Start Free TrialLog in
Avatar of Satish Kumar G N
Satish Kumar G NFlag for India

asked on

How do i fetch data from one table to another (lookup) - Related to Access Web APP

My question is related to Ms Access Webapp.

I have 2 Tables (Fields):

User Entry - Primary Data (SAP ID, Project Name, Project Manager)

User Entry - Planning Data (SAP ID (lookup from prev table), Project Name (lookup from prev table), Project Manager (lookup from prev table), many more values (not lookups from prev table))

I want to know how can I import values entered in

User Entry - Primary Data (SAP ID, Project Name, Project Manager)

to

User Entry - Planning Data (SAP ID (lookup from prev table), Project Name (lookup from prev table), Project Manager (lookup from prev table), many more values (not lookups from prev table))

what data macro to be used? or insert event or anything else.

Note: while answering please use my terms and answer please.

Thanks & Regards,
Satish Kumar G N
Avatar of Steve Bink
Steve Bink
Flag of United States of America image

Something like this:
INSERT INTO MyOtherTable (field1, field2, field3) 
SELECT field1, field2, field3 from MyOriginalTable;

Open in new window


The field lists in each part of the query need to match.  Any fields not inserted into the destination table (e.g., field4), must be capable of auto-populating their value (i.e., accepts NULLs or be assigned a default value).
Avatar of Satish Kumar G N

ASKER

Hi Steve,
Thank you for your reply, I have referred to Ms Access Webapp, not SQL database. Please do have a check and respond back.

Kind Regards,
Satish Kumar G N
Behind every web app is a database, either SQL Server or Azure.  AFAIK, to do what you want, you'll have to connect to that database to execute SQL.
ASKER CERTIFIED SOLUTION
Avatar of Jim Dettman (EE MVE)
Jim Dettman (EE MVE)
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Hi Jim Dettman,
Thank you for your reply, I did the same thing, but I get this error always. User generated image
I get this error while entering the value into the User Entry - Primary Data in SharePoint Site.

User generated image
It's saying it cannot find "SAPID"

is that the correct field name?

Should it not be "[SAP ID]"?

Jim.
I solved the SAP ID Error, but it does show the error mentioned below, the access services error, if I solve that too, when I enter setfield it updated, but the data is showed in drop down list, I don't want in drop down list, it should automatically fetch the value inserted in User Entry - Primary Data . [SAP ID]

thanks
Sat
<<I solved the SAP ID Error, but it does show the error mentioned below, >>

 Really should ask a separate question for that.

 But if you click on "Technical Details", what does it show you?    It sounds though like it is simply the wrong data type (numeric vs text for example).

Again, I have not worked with web databases, so I may not know the answer to this.   It would be better if you posted a separate question to attract the attention of others.

Jim.
Hi Jim,
Actually what happens here is I have set
[SAP ID], [Project Name] to Short Text/Long Text then ;

Error:
Access can't convert the value of 'prj01' to the specified data type.
TECHNICAL DETAILS
Correlation ID: a9159f9d-8021-2000-ad06-237fc13f4fca
Date and Time: 8/30/2016 10:58:51 PM


For Data Type: Number

Error:
You cannot add or change a record because a related record is required in table User Entry - Primary Data.
TECHNICAL DETAILS
Correlation ID: 09169f9d-b099-2000-ad06-210ec81217d4
Date and Time: 8/30/2016 11:05:27 PM


when I have normal Lookup it shows values inserted in User Entry - Primary Data as Drop down list in User Entry - Planning Data


Out Put Required :
All values in User Entry - Primary Data, Auto Filled to User Entry Planning - Data ;  Not Drop Down List.

Thanks
Sat
I am not sure I understand what it is your trying to do here.

As I said, I have not worked with web databases at all.  Let me try and find someone who has.

Jim.
https://support.office.com/en-us/article/Create-an-Access-app-25f3ab3e-510d-44b0-accf-b976c0813e71?ui=en-US&rs=en-US&ad=US

An Access app is a database that you use in a standard web browser, but which you design and modify in Access 2013 or later. The data and database objects are stored in SQL Server or Microsoft Azure SQL Database, so you can share the data within your organization using on-premises SharePoint 2013 or Office 365 for business.

Knowing that data seems to be stored in SQL server or Azure and the type of errors you are getting, it sounds like the data types may not be matching up.


Error:
Access can't convert the value of 'prj01' to the specified data type.
TECHNICAL DETAILS
Correlation ID: a9159f9d-8021-2000-ad06-237fc13f4fca
Date and Time: 8/30/2016 10:58:51 PM

For Data Type: Number

It looks like the field in question is trying to convert text to a number.

Start by detailing your file layout with file types.  Make sure the fields match up. If you have a date field, make sure you are saving date data formatted as a date.  If you have an Integer field,  make sure the data you are saving is an integer etc.
this assissted me as the solution.