Lookup Data Type in Access 2013 Web App (1 Viewer)

AccessJunkie

Senior Managing Editor
Local time
Today, 14:17
Joined
May 11, 2006
Messages
278
Hi Jane,

Let's tackle the DateDiff question first.

Your syntax for that expression is correct if you were using a desktop database within Access, but since you are using an Access web app, the expression syntax will be a little bit different.

To achieve your goal, I believe your syntax needs to be the following:
=DateDiff(Day,[Posting Date],Today())

You would use that either as the Control Source for a text box on the view or as a calculated column within a query. You don't want to create a calculated column at the table level for this type of expression.

Now for your other questions.

As I get more familiar with the technology, modify tables, add views, macros and queries etc, it occurred to me that I may have a problem when the time comes to "go live".

I think I know where you are going with this. I assume people are not using the web app yet, correct? They are still using the spreadsheet(s) while you are working on this web app to replace it, correct? Which means the data in the app is stale because it doesn't have any changes made after you imported the data.

As I understand it, I can't add new records to an existing table by copying them over (in bulk) from Excel, so when we go live, I will have to delete all the tables and recreate them from Excel with the up-to-date data, and then presumably re-define the various fields as lookup, re-run data macros etc .

Technically you are correct that you can't import new records directly into the web app tables during an import operation. Access will always create a new table during this process. Which means of course you don't have the new data in the correct master tables(s).

On the delete issue, I'll get back to that in a second...
You also said:

What I'm not sure about is whether when I delete a table, will it delete all views, macros, queries etc associated with that table, and if so, then will I be effectively having to recreate the app in its entirety???

To answer this question, yes if you delete a table in a web app, Access will automatically delete all associated views tied to that table that show up in the View Selector. You could still have some related objects around though like queries, data macros, related views not in the View Selector, etc. that would no longer be functional. So in essence, yes, you would be starting completely over. Naturally, I do not recommend this approach at all!

So how do we do this then?

When you are ready to go live with all the correct and up to date data, I do the following:
- Make a back-up copy of the app. I'm a back-up freak so I always take lots of backups. This step is optional, but its good for peace of mind.
- Clear out all records in all the tables. This is super, super easy to do using data macros. A simple ForEachRecord loop with a DeleteRecord action inside the loop will clear everything out. You need to start with the child tables and then move on to the parent tables.
You could optionally just save a backup copy of the app and elect not to include all the data. Then install that empty app and start from there.
- The next step is to import all of the data from the Excel spreadsheet(s) into the app with empty tables. When you import, provide different names for the new tables that will be created. You now would have all of our original master tables with no records as well as new tables with all of the live data.
- The final step is to create some new data macros that will "copy" the data from the imported temp tables into the master tables. The lookup fields to related tables would also have to be accounted for in this step as well. After this is complete just deleted the imported tables so you are left with just the master tables and objects.

That might all seem a bit scary at this point, but trust me, it can be done. I've done this very thing many times and even on some very large Access web apps that I've helped created that are being used throughout the organization here at Microsoft.

So what I would suggest at the moment is keep plugging away on what you've been doing so far. Keep modifying and adding to the app as you have been doing until you've think you reached a point where you are ready to go live. Once you've reached that point, then we can take care of getting the correct data into the app, turn your users loose on the web app, and then tell them to stop using the Excel spreadsheet going forward. You can continue to make more changes to the app even after it is use as well.

Does that help?

--------------------
Jeff Conrad - Access Junkie - MVP Alumnus
Senior SDET - Access Test Team - Microsoft Corporation

Author - Microsoft Access 2013 Inside Out
Author - Microsoft Access 2010 Inside Out
Co-author - Microsoft Office Access 2007 Inside Out
Access 2007/2010/2013 Info: http://www.AccessJunkie.com

----------
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.mspx
----------
 

JaneJohnstone

Registered User.
Local time
Today, 22:17
Joined
Jan 2, 2014
Messages
20
Jeff,
Thanks for your update. It's good to know that I won't have to start from scratch again when I'm ready to go live. I guess I will have to practice the steps involved in copying across the data (otherwise it may take me so long to work out what I'm doing that the data is out of date again before I complete the process!!!!).
Once again - many thanks for your time.
Jane
 

tacklers

New member
Local time
Today, 22:17
Joined
Jun 11, 2014
Messages
6
Jeff,

I was also very puzzled by the requirements of lookup when converting a field in an imported table but your instructions sorted it for me so I am very grateful.

Knowing what I know now I still cannot piece it together from your Inside-Out book, maybe a mod for V2?

Cheers, Richard
 

NathanBurley

Registered User.
Local time
Today, 22:17
Joined
Jul 28, 2015
Messages
19
Jeff,

I wanted to start by saying thanks for going to all that trouble - it didn't just help Jayne it helped me immensely. I've now got my head around the way the lookups work but I am having a few issues with macros populating those ID values:

The main issue I have is that blank or unmatched result inherit ID values from inappropriate records, for example if I'm trying to get connect Devices with Insurance Contract references I check the Contracts table for references which match the reference held against the Device, however some devices don't have Insurance Contracts to cover them (they're covered under Trade terms) so there's no reference to match. In this case the macro seems to fill the new reference field with the last ID which was used... I can't work out why the logic allows this but wondered if you could point me in the direction of fixing it please?

This issue also occurs if the reference it's looking up doesn't exist in the Contracts table.

Any help would be much appreciated!

Many thanks,

N
 

NathanBurley

Registered User.
Local time
Today, 22:17
Joined
Jul 28, 2015
Messages
19
OKay, I figured it out.

Following the part in the macro where you set the new reference to the local variable value, the variable value needs to be set to 'Null'. Otherwise, everytime the lookup fails and there's no value which corresponds to the old reference the macro just input the variables current value - from the previous loop.

Nathan
 

Users who are viewing this thread

Top Bottom