?
Solved

Automate Open form, press Alt+R and close form

Posted on 2013-12-01
4
Medium Priority
?
340 Views
Last Modified: 2014-10-29
Hi all,

I need a (event) button on the main form to open a form in ms access, the combination alt R has to be automatically entered and the form needs to close after the data has bean .

The combination keys "alt r" is needed to read data from the barcode reader.

After reading  the data in the opend form another subform on the main form needs to reload because the data that is entered needs to show the new data.

thanks!

I have the code for the On click event but th code for the shortkey and reloading the suborm is missing

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "Offer"
    DoCmd.OpenForm BarcodeDataForm, , , stLinkCriteria

 DoCmd.Close acForm, BarcodeDataForm

Open in new window


I have found custom MySendkeys But don't know how to use it.
0
Comment
Question by:mvdwal
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 20

Accepted Solution

by:
GrahamMandeno earned 2000 total points
ID: 39688773
Hi mvdwal

You should open your form modally which means that the code which opens it will not continue to execute until the form is closed or made invisible.  Then you can requery the subform:
Private Sub cmdReadBarcode_Click()
    DoCmd.OpenForm "BarcodeDataForm", WindowMode:=acDialog
    Me.[SubformControlName].Form.Requery
End Sub

Open in new window


I assume that BarcodeDataForm is opening in DataEntry mode and adding a new record to a table.  You would probably be best to use the GotFocus event of the textbox to send the Alt-r, and use the AfterUpdate event of the same textbox to save the record and close the form:
Private Sub txtBarcode_GotFocus()
    SendKeys "%r"
End Sub

Private Sub txtBarCode_AfterUpdate()
    RunCommand acCmdSaveRecord
    DoCmd.Close acForm, Me.Name
End Sub

Open in new window

Good luck :-)
Graham Mandeno [Access MVP since 1996]
0
 

Author Comment

by:mvdwal
ID: 39692130
Dear Graham Mandeno,

Thanks a lot! I will try your method this week! I'll keep you posted!
Kind regards,
Michiel
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question