Visual Basic (1 Viewer)

holden_1

Registered User.
Local time
Today, 20:05
Joined
Feb 2, 2005
Messages
38
Hi,
Many thanks to those who helped with my last couple of problems.

I've allmost completed my project now and am debugging.

I've found that in order to close one of my forms, which has combo boxes on it, I need to have no values selected in those combo boxes. Could someone give me the visual basic script (or any alternative meathod) for resetting the combo boxes to their default values; i.e. nothing selected in them!

Many thanks,

Robin :eek:
 

GabrielR

Registered User.
Local time
Today, 15:05
Joined
Oct 6, 2004
Messages
63
holden_1 said:
Hi,
Many thanks to those who helped with my last couple of problems.

I've allmost completed my project now and am debugging.

I've found that in order to close one of my forms, which has combo boxes on it, I need to have no values selected in those combo boxes. Could someone give me the visual basic script (or any alternative meathod) for resetting the combo boxes to their default values; i.e. nothing selected in them!

Many thanks,

Robin :eek:

Try this:
Code:
Me.Yourcombobox = Null
Code:
 

holden_1

Registered User.
Local time
Today, 20:05
Joined
Feb 2, 2005
Messages
38
Cheers that work a treat!

Got another one for you tho! (I don't know much VB)...

I want to only run this command:

Me.[Part Number] = Forms!frm_Menu_Create_CR!cbo_Parts

If cbo_Parts is not a Null value.

I tried, using my limited knowledge, a couple along these lines:

Private Sub Form_BeforeInsert(Cancel As Integer)
If Forms!frm_Menu_Create_CR!cbo_Parts Is Not Null Then
Me.[Part Number] = Forms!frm_Menu_Create_CR!cbo_Parts
Else:
End If
End Sub


mostly I get error "242 - Object Required" when I enter anything into a box on the form containing [Part Number] other than [Part Number].

If you see what i meen...

Your help would be much appriciated!
Think this is the last problem now :)

Robin
 

GabrielR

Registered User.
Local time
Today, 15:05
Joined
Oct 6, 2004
Messages
63
Yeah have had that one before.. Try

Code:
Private Sub Form_BeforeInsert(Cancel As Integer)
If Not IsNull (Forms!frm_Menu_Create_CR!cbo_Parts) Then
Me.[Part Number] = Forms!frm_Menu_Create_CR!cbo_Parts
Else:
End If
End Sub
 

Users who are viewing this thread

Top Bottom