ComboBox to open forms

Tomrobo

Registered User.
Local time
Today, 17:36
Joined
Dec 2, 2010
Messages
12
Hi I'm currently creating a form that will allow a user to enter a college course onto the database. However some courses cannot be selected with certain courses.

Currently i'm using a combo box that will allow the user to select a prerequisite from a dropdown. However if the course is not listed I need the course and its details to be entered.
For this I will have another form that will allow the user to enter the details of the prerequisite and then select it from the drop down.
I have added a record called '>CREATE NEW' into the table that the combo box is attached to.

Here is the code

[/Code]
If [ComboPreReq] = ">CREATE NEW" Then
DoCmd.OpenForm "NewCourseInput"
Else
MsgBox ""
End If
[/Code]

However it does not appear to be functioning and the form will not open which the 'create new' is selected.

Obviously i'm very new to VBA!

Many thanks in advance

T
 
Where do you have this code being triggered?
 
Where do you have this code being triggered?

Thanks for your reply. I've attempted to trigger the code on the ComboBox itself on an AfterUpdate and a OnClick with no success as yet.


Many thanks
 
This as not working so I decided to look at where in the index of the combo the ">Create New" was and did the if statement based on that.

Code:
If ComboPreReq.ListIndex = 0 Then
    DoCmd.OpenForm "NewCourseInput"
    MsgBox "OK"
Else
MsgBox "Error in test"
End If
 
Can you upload a sample of your database so I can take a look
 

Users who are viewing this thread

Back
Top Bottom