I need help regarding this database which i shown in attachment.
means if combobox if Deparment is emty then combobox of Location and subform should be empty.
I need the proper code for this.Thanks
I need help regarding this database which i shown in attachment.
means if combobox if Deparment is emty then combobox of Location and subform should be empty.
I need the proper code for this.Thanks
In the After Update Event of the Combo Box -> you can put something like this:
If Me.ComboBoxDepartment = "" Then '[Or - you may need If Me.ComboBoxName Is Null]
Me.ComboBoxLocation.SetFocus
Me.ComboLocation.Text = ""
End If
To cover both ZLS ("") and Null you can use: If Len(YourControl & "") = 0 Then
In after update event there is already Embedded Macro.How I can add Event procedure too?
What is the embedded macro doing?
Convery the Macro to VBA and we can show you what to add. http://www.btabdevelopment.com/ts/de...aspx?PageId=91
RG - thanks for that link!
I often run into embedded Macros that I inherited here at work & I like that I can convert them to VBA & tweak them in an environment I feel I have more flexibility in.
A Combobox can only be 'empty' when no selection has been made from it, or when a selection made has been deleted. Once a selection has been made, you cannot scroll the Combobox and select a blank item again.
So, in this kind of Search Form, a pretty standard approach is to go to a New Record when the Form is first Loaded. If you want the Record to go back to being 'blank,' if the user deletes the Combobox selection, you can do the same thing in the AfterUpdate event of the Combobox, when it's 'empty."
Code:Private Sub Form_Load() DoCmd.GoToRecord , , acNewRec End Sub Private Sub ComboName_AfterUpdate() If Nz(Me.ComboName, "") = "" Then DoCmd.GoToRecord , , acNewRec End If End Sub
Linq ;0)>
Thank you very much you really solved my this problem.A Combobox can only be 'empty' when no selection has been made from it, or when a selection made has been deleted. Once a selection has been made, you cannot scroll the Combobox and select a blank item again.
So, in this kind of Search Form, a pretty standard approach is to go to a New Record when the Form is first Loaded. If you want the Record to go back to being 'blank,' if the user deletes the Combobox selection, you can do the same thing in the AfterUpdate event of the Combobox, when it's 'empty."
Code:Private Sub Form_Load() DoCmd.GoToRecord , , acNewRec End Sub Private Sub ComboName_AfterUpdate() If Nz(Me.ComboName, "") = "" Then DoCmd.GoToRecord , , acNewRec End If End Sub
Linq ;0)>
But I request Moderators that plz don't close or put in solved categories this thread. bcoz I have to ask some more codes in this thread.Thanks
Glad we could help, but unless you have further questions regarding this specific problem, you need to start a new thread with an appropriate title.
Good luck with your project!
Linq ;0)>
when I am trying to open my form it gives the attached error/
Does your project compile without errors?
Plus: when I restart my database it start working.
then again I close and restart not working again.
sometime working sometime not.