Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open a specific record on a form 1

Status
Not open for further replies.

pbrown2

Technical User
Jun 23, 2003
322
US
Without using a combo box, is there away I can open a specific record through a form?
Currently in the query "BudgetCoordinatorEMail" there is [Enter UserID] in the criteria for UserID. However, when the form is opened, this seems to be skipped.

This is to be used so that once a budgetCoordinator or "BC" registers with the database, I am sent an e-mail to check to ensure they are a BC before they recieve the BC password to the database. If they are a BC, I would like to simply open this form to their record and click a "Send" button to e-mail the form to them, (I do not have a problem with the button). That is why I have, at this point, excluded the idea of a report. Simply because I would have to run the report the send the report as a snapshot, etc. Or if I use a Macro to automatically send upon opening and accidently mistype the id, the password would go to the wrong person.

Therefore, it would be much easier to open the report and have it ask for the ID to find the correct record or allow me to type the id in and then have it search. This would allow me or whomever, to see who the e-mail would be going to before actually sending it.

Once again, I would prefer to stay away from combo boxes, but it that is my only choice, so be it....

Any suggestions???

Query Name: BudgetCoordniatorEMail
UserID field: UserID
Form Name: UserBC

Thank you for any and all help,

PBrown
 
One thing you may want to do is to set the OpenArgs argument to the string equivalent of the user ID #. This argument is in the DoCmd.OpenForm method.

DoCmd.OpenForm "frmBC",,,,,,CStr(Me.tbxUserID.Value)

Setup the Open Event to check the OpenArgs property of the form that is being openned for the user ID number

Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.OpenArgs) Then
Cancel = True
Else
'Run your BC check here

'Set some boolean variable to either true or false, such as bolBC
If bolBC Then
'Set the form to the BC's record rather it be via the bound form or via some other way such as DAO coding.
Else
Cancel = -1
End If
End If
End Sub

Ronald R. Dodge, Jr.
Production Statistician
Master MOUS 2000
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top