|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
VBA in Access 2000 HELP!!
Hi, Im struggling with some code, i want a query to run after i have clicked off a textbox on a userform. So first of all i used the OnExit property of the textbox on the userform, and then used vba to hopefullly perform what i want to happen. The code i used is:
Private Sub Departure_Exit(Cancel As Integer) If DoCmd.OpenQuery(Qrydepdes) Then Exit Sub Else DoCmd.OpenForm (FrmNewJourney) End Sub I need the query to give the result as yes there are results or no there isn't results. and this code brings up the error to do with the .OpenQuery part. don't know what to do! It comes up with a Compile error, expected function or variable. Thanks for any help!! Last edited by cjr_chris : February 23rd, 2004 at 01:07 PM. Reason: Wasn't quite correct |
|
#2
|
|||
|
|||
|
Quote:
' You can't use the "If" with DoCmd. . . . and this negates the whole procedure. Also ' DoCmd requires the object name enclosed in quotes parenthesis outside the quotes is optional. If you correct this first, the whole procedure will show up as an error. ' Is the Departure control a text box?, a check box?, an option button?, or is it really a ' text field? Something here is incorrect. ' Use the AfterUpdate or Click Property of the Departure control. ' Test for the value of the Departure control. ' Test Query for .BOF and .EOF properties (empty). ' An empty Select Query will display with or without records. ' Add End If, if it's a multi line IF statement |
|
#3
|
|||
|
|||
|
Sorry, a follow up correction to my previous answer.
.OpenForm or .OpenQuery paramaters can only be enclosed with double quotation. Parenthesis is not an option. |
![]() |
| Viewing: Dev Articles Community Forums > Databases > Microsoft Access Development > VBA in Access 2000 HELP!! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|