How can I access files in NAS through VBA - vba

I'm building product inspection system using VBA
in a manufacturing company which is SMB.
Succeeded to access DB in NAS(it was pre-installled) to
read and write data.
But I can't figure out how to access files in NAS Server
I need to read and show item pictures on userform
for users to check Item and Part Number
Currently doing it using network connection
(It considers NAS is connected as local & VPN network participant
so i just load it like "pictures.insert("10.0.0.#######.jpg")")
is there any other way to connect and access the picture
not by VPN
prbly i should write codes to
connect / find forwarded port / verify as user / read file
but dont know how.
Thank you for any advice or opinions alot!

Related

Dynamic URL in content-field in Petaho Report Designer

I have bit of a problem here. I have created report in PRD 7.1 which is showing data from database. The last column in DB is path to a image, that is stored on disk (of the machine where Pentaho is running).
So bacisaly, I have Open formula that is: =IFNA("http://myserver.com/snapshots/" & [path_to_snapshot]; "http://myserver.com/image_icon_2.png") which is value of content field.
It is working well deployed on the public server, report shows the picture and when someone click on it, it opens the picture.
However, as I have deployed this on a server that has no public address and can be accessed through more VPN IP addresses, there is a problem. I have to specifically write IP address of server into the formula, and while it will show picture in report, it wont show it after clicking on the picture (unless you are accessing the server from the one specified IP address).
Its also not working with either localhost nor 127.0.0.1 in the IP address field.
Could please anybody explain me where the problem is and how to make it work?
I am not very skilled in web things. I do understand that it is not showing picture, because after I click on it, it is looking for it on my machine (in case of localhost or 127.0.0.1) but why it is shown on report than?)
Well my friend, it can be a lot of reasons, even not pentaho related, but, it's a light in the deep end of the tunnel, you are lucky today.
If the problem is the IP address, you need to register it in your DNS (or company's DNS), so, if the IP address changes, the DNS query will return the current IP address and will show the image.
It's not clear the VPN setup you are using, either the pentaho deployment setup, so it's hard to give you a better answer.

Fetching machine details remotely from large group of computers

I'm trying to remotely collect few details (machine name, user name,MAC address, Serial number, OS version etc) from the large group of computers.
I have come up with different ways.
Method 1:
Deploy a script on all the machines, script will fetch the details from machine and write in to a shared excel file present in the network file share.
Challenges:
The target environment doesn't have network share folders enabled.
Challenge in concurrent updating the excel from multiple machines at the same time.
Method 2:
Deploy a script on all the machines, which will run fetch the required details and send an email to particular email address with all the required details in subject line.
After all the email are received, admin can copy those emails and copy to excel, so it copies the subject line of the emails in excel rows. Later admin can delimit and seperate the column for desired report.
Challenges:
This method tried and working fine. But challenge is no.of charecters in the email subject is limitted to 256 hence can't fetch more details.
I would like to request whether anyone has any inputs or other possible methods to achieve the target.
Thank you

How to get my vb.net program to use one network over another

vb.net programmer and I am curious to know if there is a method to use so any program i am developing can select a specific network. I am asking this because i recently noticed that while on the wifi, i was still able to access a mapped drive from the lan connection. if there are any resources out there to enlighten me, im all ears because its annoying to constantly switch to my lan connection every time i have to test or deal with a db issue. Additional information: my programs connect to microsoft sql servers on the lan network.
Well I think I found an answer to my question, though it does not have anything to do with vb code. Since I am only dealing with two connections: my departments wifi and may workplace's main network(lan) , I decided to change the metric value of the lan connection to 9999 and left the wifi as automatic. somehow Im able to keep both connections open and my program connects normally to the mssql sever on the lan while im able to use my department's wifi for testing and browsing. interesting stuff there. thanks for the interesting links though.

Reading from database file over network in visual basic, with no shared drives

The machine I'm trying to access is an industrial PC that serves as the interface for some PLC-automated equipment. The computer creates a data record (an .mdb database) of the various machine settings so that they can be reviewed later if desired. I've created an application in Visual Basic 2010 to display and sort that information once it's been copied from the machine to someone's laptop.
What I'd like to do, though, is allow the user to access the database from their laptop over the network; each PC has a static IP address on the customer's LAN. Currently, we can use Teamviewer to transfer files, but I'd like to include that ability in my data viewing application. Without changing any settings on the industrial PC (i.e. leaving the network file sharing alone, and avoiding installing any sort of SQL server software), how can I access this information? The database files can get pretty large (40+ mb) so I'm trying to avoid any sort of FTP transfer, which would undoubtedly take forever.
The database is already set up on an ODBC connection (which is how the pc stores the PLC information in the database), and I suspect that this may be the key, but between my lack of any thorough understanding regarding networking and the internet's general distrust of ODBC (well earned, from what I've seen so far), I'm having a hard time finding any useful information.
If anyone could point me towards some useful tutorials, or give me a good place to start, I'd appreciate it.
I think you are out of luck. Think about it, if you could access the file, without sharing it, wouldn't that be a serious security problem?
What you can do: Use the always existing share \host\c$ to access the file. For that you'll need administrative privileges for the host.
But be aware: Even if this "works", it introduces problems:
It will be slow, because you are essentially copying 40MB over the wire over and over again
If you are not carefull, you might lock the *.mdb file while accessing it. Access Databases are not really meant to be accessed by multiple users/processes. That didn't prevented Microsoft to try to fake it. Todo so, a *.ldb (L as in Lock) file will be created, to signal other processes the file is locked.
Tldr: Don't do it.

MS Access / Sharepoint Online link to Database to allow multiple users / VBA?

Ok, our current problem is the classical "trying to allow multiple users access onto one fe file (this is in runtime currently)" - This cannot be handled (at least in AC2007) and is best solved by installing a FE on each computer that is using it.
This poses another problem for us, we have many employees who we want to be able to have access to it, yet the program probably doesn't warrent our techs to push out updates of this file to each computer with their "patches" (plus there may be added costs to doing such for us).
We would really prefer the ability for users to open a link from our internal portal to the file as can be currently achieved. We are mulling over the possibility of pushing out 4 or 5 copies of the FE application on a shared folder and creating an Access program that would essentially check to see if a FE app is open say FE1 and if so it would open FE2 (and so on) then close the sharepoint linked database that did the checking so a new user could open that. This would allow multiple users access to the same BE information using the same FE program.... would this work? Any ideas of how to go about it?
Yes it works, the idea is to create a function that checks for the open file, if it finds its open it replies with an error, on the error you can move to the following database. Here is a sample code:
Option Explicit
Function FileLocked(strFileName As String) As Boolean
On Error Resume Next
Open strFileName For Binary Access Read Write Lock Read Write As #1
Close #1
If Err.Number = 0 Then
Application.FollowHyperlink "c:\MasterMAX.accdr"
DoCmd.CloseDatabase
End If
If Err.Number <> 0 Then
Application.FollowHyperlink "c:\MasterMAX2.accdr"
End If
End Function
Disclaimer: I don't know anything about SharePoint, so I can't say if my proposed solution is still viable when SharePoint is involved.
If your problem is just how to distribute the file to all machines, why don't you let your users start a batch file that copies the Access frontend from a network share to each machine and starts it?
We are doing something similar at work (without SharePoint, though), and I described our setup here:
How to automatically update MS-Access 2007 application
We have put the batch file on a network share as well. The users have just shortcuts on their desktops to the batch file on the network share, so it's easy to update the batch file as well.
Maybe you can do something similar (let the users run the batch file from SharePoint, which copies and starts the Access frontend).