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!

Validation Rules

Status
Not open for further replies.

arobbo

IS-IT--Management
Feb 15, 2005
62
GB
having a few troubles with validation rules and the expression builder.

basically i've got a form with a drop down box and a button, if nothing has been selected i would like an error message to pop up, so far i've had no joy with the validation rules for the combo box,

anyone got any ideas what the expression would be in the ...
bit

Cheers

Andy
 
When do you need the message box to popup? OnClicking the command button?
Code:
Private Sub MycmdButton_Click()
    If IsNull(Me.MyComboBox) Then
        MsgBox "Not Selected"
    End If
End Sub

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
Excellent that did the trick

Any clues as to how i could close the current form when clicking on a button that opens a new form.

otherwise i'm getting 100s of windows

i'm sure its something really simple but unfortunately my VB is really really limited ;)

Cheers

Andy
 
Take a look at the DoCmd.Close method.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Code:
Private Sub cmdOpenForm_Click()
On Error GoTo Err_cmdOpenForm_Click

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "[b]SecondFormName[/b]"
    DoCmd.OpenForm stDocName, , , stLinkCriteria
    [b]DoCmd.Close acForm, "FirstFormName"[/b]
Exit_cmdOpenForm_Click:
    Exit Sub

Err_cmdOpenForm_Click:
    MsgBox Err.Description
    Resume Exit_cmdOpenForm_Click
    
End Sub

________________________________________
Zameer Abdulla
Visit Me
The best thing to spend on your child is your time.
 
Thanks the first one seemed to work fine,

thanks both for your replies

Andy
 
Been having a few troubles with closing a form when i open a new one.
seems to work fine on some forms , but other forms that appear to have the same code don't work.

The code i'm using for closing the current form and opening up a new form is shown below....

DoCmd.Close

stDocName = "Manufacturer_no_Nav"

stLinkCriteria = "[Man_ID]=" & Me![Man_ID]
DoCmd.OpenForm stDocName, , , stLinkCriteria

can anyone spot anything obviously wrong with it ?

Cheers

Andy
 
Close the current form AFTER opening the other.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Thanks both for your help, works again now

;)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top