take a snapshot with a webcam from ms access form - ms-access

i need to take a snapshot with webcam when someone press a button in access form.
Is it possible?
i know how open a program from access but i'm stuck on how to trigger the event
the code
Private Sub Command1_Click()
Dim stAppName As String
stAppName = "C:\Program Files\myapp"
Call Shell(stAppName, 1)
End Sub
now let's say the snapshot trigger by f12 key in the app
how do i get the f12 key to click automatically

ok i got it
if any one want to know here is the method
1.by 2 macros "runapplication" & "sendkeys"
with "runapplication" just put the path of the app
with "sendkeys" just put the command SendKeys "{yorkey}"
by the way you need to press show all command in the the toolbar
or you can do it in vba code

You could try this if you are in windows 8/8.1
Dim cameraPath As String
cameraPath = "shell:AppsFolder\Microsoft.MoCamera_cw5n1h2txyewy!Microsoft.Camera"
Shell "explorer " & cameraPath

Related

MS Access - Command button wont function at all

I have tried to Google and review previous Stackoverflow posts but I cannot seem to find a solution and this seems like such a simple fix.
I put a Command button in my Form because i wanted to test exporting information within the form to an Excel spreadsheet.
Private Sub cmdExportFilename_Click()
Dim sFilename As String
sFilename = "C:\Users\Redacted\Desktop\exportResults.xlsx"
DoCmd.OutputTo acOutputQuery, "OpenComplaintsQuery", acFormatXLSX, sFilename, AutoStart:=True
End Sub
I made sure the OnClick event was set to [Event Procedure] but when i go into form view and click nothing happens not even an error so i feel like i am still missing something that is telling that button to run that code. i checked my Trust Center settings and changed it to enable code but still nothing.
Any advice is helpful!

MS Access Office 365 keeps crashing when opening a popup form

I am using a windows 7 Enterprise 32-bit operating system and Microsoft Access 365 ProPlus.
I open a form then when I double click on a field it triggers an event procedure that opens another form. This form is a Pop Up form (non model) single form default view. Everything was working great for the last year or so and for some reason when I open the form this way the access program crashes.
I can open the form by selecting it from the search forms dialog.
What I found works is I need to open the form then edit it in design view. Make a small change in the form and save it. Then view it in form view and close the form. Once I have done all this I can run my program normally and everything works great until I close access and re-open it. Then I need to do it all over again.
I have ran the compact and repair tool several times.
My code is a very simple one:
On Error GoTo Err_Command18_Click
Dim intBuildingId As Integer
Dim StDocName As String
intBuildingId = Form_Frm_Buildings.Building_ID
StDocName = "Frm_Buildings_To_Frm_Manager"
Me.Refresh
DoCmd.OpenForm StDocName
Forms(StDocName).Recordset.FindFirst "Building_Id = " & intBuildingId
Err_Command18_Click:
Exit Sub
Any help would be appreciated and thanks in advance!
Mark

MS-Access 2007 on WinXP, can't break out of requery looping in Form_Current sub

I set a form "frmMain" to automatically display when the database is opened by naming it in: Access Options, Current Database, Display Form: frmMain.
In a lapse of judgement of enormous proportion, I included the statement me.requery at the beginning of the class object module Form_frmMain's Private Sub Form_Current() routine.
Now, whenever the database opens, it starts requerying over and over until after a second or so it displays a message: "Run-time error '3420': Object invalid or no longer set." Selecting End or Debug both have the same effect: me.requery is highlighted in yellow and a new "Object invalid or no longer set." message is displayed.
I've tried multiple Ctrl-Breaks, and Escapes, and can't get the console to return any control to me. I can kill the process with the Task Manager, but that of course doesn't let me get into the VBA code to remove my ridiculous me.requery.
Can someone help me out here? Thank you! Dave
After you kill your program from task manager, open your db file(I assume it is .accdb) by pressing down the shift+enter keys.
After you open your file you`ll see your database screen in front of you. Just double click a module to open the VBA editor or simply press ALT+F11. Then, youll be able to find your function.

How to present a MS Access Form to the end user?

I created a form in MS Access. Unfortunately I cannot publish to access services or make a package solution
I am looking for a user friendly way to present this form to the user. So far the user will open the ms access file , click on the form and fill it out.
I would like to have a way to provide the form ONLY. I do not want the user to see all the tables and the structure . . Is there any way i can separate the form from the tables, queries etc. list ?
I split the database, and gave a fe copy to the user, but it still sucks! All those panels and stuff. Does MS Access has anything to address this issue ?
The issue(s) of splitting the database, and the issues of creating a compiled accDE are NOT ONE BIT RELATED to hiding the Access interface.
100% separate question and issue.
Now, without question the above should be done for any access application, but THE ABOVE HAS ZERO TO DO WITH hiding the access interface.
Once you get the access UI hidden, then you can consider the idea of compile to accDE a good idea to PREVENT users from getting into the access UI parts.
Same goes for splitting. You really need to split. However, AGAIN the splitting has NOTHING to do with hiding the accsss interface.
So now, lets get on to hiding the access interface.
To hide all of the access interface and ONLY show the form, you need to add ONE LINE to your start up code (the forms on-load event is fine).
So, specify the form you want to display in the options.
Add this ONE LINE of VBA code to the forms on-load event.
DoCmd.ShowToolbar "Ribbon", acToolbarNo
The additional settings you require are:
[x] Display Navigation Pane <-- uncheck this box.
[x] Use Access Special Keys <-- uncheck this box
Set access to use tabbed interface, and un-check the box to display tabs.
The form MUST NOT be popup. It can be model, but NOT popup.
The result is you will ONLY see the form. This shows the result:
Now keep in mind to get back to "developer" mode, you have to exit, and then hold down the shift key during startup. When you get all of this working, then you want to compile to an accDE, and search out some answers on how to disable the shift key during startup to prevent your users from seeing the access UI.
So you ONLY need one line of code to achieve this goal. The rest is just choosing the correct settings in your application, and that one line of code on startup.
Steps for publishing the compiled accde file and making it ready for end user:
BackUp: Take backup of your accdb/mdb file
Uncheck following elements from Database Options
(Office Button=>Access Options=>Current Database) :
Display Navigation Pane
Allow Full Menus
Allow Default Shortcut Menus
Security: To prevent anyone bypassing the start-up by using the Shift key and access the table use below code :
Public Function DisableByPass()
On Error GoTo err_proc
'Disable By Pass Key in mde/accde db
Dim dbs As DAO.Database
Dim prp As Property
Dim strMDE As String
Set dbs = CurrentDb
With dbs
On Error Resume Next
strMDE = .Properties("MDE") 'If this is an MDE or ACCDE database, disable bypass key
If Err = 0 And strMDE = "T" Then
.Properties("AllowByPassKey") = 0
If Err.Number = 3270 Then
On Error GoTo err_proc
Set prp = .CreateProperty("AllowBypassKey", dbBoolean, False)
.Properties.Append prp
.Properties.Refresh
End If
End If
End With
exit_proc:
On Error Resume Next
dbs.Close
Set dbs = Nothing
Exit Function
err_proc:
MsgBox Err.Description
Resume exit_proc
End Function

Hyperlink "deactivated" after VBA on textbox

I've been using VBA and available modules to integrate the browse for directory and browse for file functionalities in two different MS Access projects. Here are the example files where I took the functionalities from:
Browse to folder: http://www.lebans.com/callbackbrowser.htm
Browse to file: http://www.access-programmers.co.uk/forums/showthread.php?t=97787
In both my .mdb projects, I have tried to browse for a file/folder, then output the address to a hyperlink textbox, linked to a hyperlink field in a table.
It has mostly worked, but unfortunately, with both these functionalities, the hyperlink stops working... The output to the textbox and to the table seems perfect, but when I click on the hyperlink, it does not take me to Windows Explorer.
To make the hyperlink work, I have to double click on the textbox, (which then lets me edit the field) remove the last letter, then type it back again, and tab out. Then, when I click, Windows Explorer opens normally, as a hyperlink should.
What is the solution? I've already tried:
DoCmd.RunCommand acCmdSaveRecord
Without success...
Thanks for your help
If I understand you correctly, you want to open an explorer window for a specified directory set in the textbox?
If so, you'll need to use the textbox on-click event, something like this:
Private Sub TextBox1_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Shell "C:\windows\explorer.exe """ & TextBox1.Value & "", vbNormalFocus
End Sub
Or, you can use the double-click event:
Private Sub TextBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
Shell "C:\windows\explorer.exe """ & TextBox1.Value & "", vbNormalFocus
End Sub
By the way, I could only test this in Excel - I don't have Access installed, but it should be the same.
I found the answer to my question on stackoverflow:
Access - Hyperlinks Aren't Linking
Turns out you need to concatenate #'s before and after the hyperlink address for it to work properly as a hyperlink.