|
Answer» I have a microsoft access DATABASE for computer inventory.
I would like to add a button that when clicked, will open a remote desktop session (RDP) to connect the computer that we are looking at.
We have a batch file that might help with this code intergration.
TITLE Brett's Remote Connection Tool mode con:cols=100 lines=50 @color E @echo off REMThis is the main menu of the program. goto menu :menu echo Brett's Remote Connection tool v1.0 echo. echo. echo This program will remotely connect to the PC of your choice. echo. echo ______________________________ echo ! ! echo ! 1. Connect to laptop ! echo ! 2. Connect to desktop ! echo ! 3. Freeform entry ! echo ! 4. Exit ! echo ! ! echo !______________________________! echo.
REMThis establishes what part of the file each user input will correspond to. :choice set /P C=Enter Selection #: if "%C%"=="4" goto quit if "%C%"=="3" goto freeform if "%C%"=="2" goto desktop if "%C%"=="1" goto laptop goto choice
:desktop set /p D=Type the desktop number: start mstsc /v:MAX42MGWK%D% /w:640 /h:480 goto menu
:laptop set /p L=Type the laptop number: start mstsc /v:MAX42MGLP%L% /w:640 /h:480 goto menu
:freeform set /p F=Type the entire PC name: start mstsc /v:%F% /w:640 /h:480 goto menu
:quit exit :endThis is way over my head. May I ask if you have DONE a Google for other forums that are more SPECIFIC to your project. That's a rhetorical question. Of course you have. You would have used these keywords: Microsoft Access remote desktop menu SCRIPT You would have come across sites named freelancer. Still, let me ask: Have you looked at http://freelancer.com or http://freelancer.com.au to see what projects they have like yours? They have both twitter and facebook links, so maybe you can find some free advice. Just a thought. And no, I do not work for them. Wish I did.Since we don't have members who are well-versed in Access, as far as I know, I'm going to take the liberty to SUGGEST an Access-specific forum. It's http://www.accessforums.net/ Two problems:
You mention nothing about how your form is laid out You mention nothing about your table and field layout.
Since Access is just VBA, you can just use the shell() function from within the Button Click event of a form in access.
Without knowledge of your database schema, I created my own to serve as an example.
It consists of a single table, tblComputers, which merely lists two computer names (Field:Compname), as well as some otherwise useless satellite data (the type of the machine, laptop or desktop) (field:Type). I added two entries to the table corresponding to my two machines, record navigation buttons, that type of stuff.
The important bit is the "connect" button I added. The code simply runs "Shell":
Code: [Select]Private Sub Detail_Click() Shell "mstsc /v:" + CompName.Text + " /w:640 /h:480" End Sub
Presumably, your database scheme also includes whether they are a desktop or a laptop; (based on the content of the batch file) in which case you could build the computer name to use like so:
Code: [Select]Private Function GetConnectName() as String if MachineType.Text="Desktop" Then GetConnectName="MAX42MGWK" + DesktopNumber.Text Else GetConnectName="MAX42MGLP" + LaptopNumber.Text End If
End Function
and then the Click event becomes:
Code: [Select]Private Sub Detail_Click() Shell "mstsc /v:" + GetConnectName() + " /w:640 /h:480" End Sub
Without more info on your database schema/form setup, I can't really provide anything more specific than that.
|