DBL click problem.

J

John Freeze

I am running Office97 patch 2.

I used the wizard to create a Recipe Database.
The person that I am making this for asked me to add in "Units Of Measure"
to the "Recipes Subform".
This was not a problem, but she wanted a pop up window like the
"Ingredients" table/form.
I created the table, form, and added in the following code (please see
below), but on a dbl click, nothing happens. When you dbl click on
ingredients, a new window opens.

Please any help would be greatly appreciated.
Thanks in advance.



Option Compare Database
Option Explicit

Private Sub IngredientID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub IngredientID_DblClick(Cancel As Integer)
On Error GoTo Err_IngredientID_DblClick
Dim lngIngredientID As Long

If IsNull(Me![IngredientID]) Then
Me![IngredientID].Text = ""
Else
lngIngredientID = Me![IngredientID]
Me![IngredientID] = Null
End If
DoCmd.OpenForm "Ingredients", , , , , acDialog, "GotoNew"
Me![IngredientID].Requery
If lngIngredientID <> 0 Then Me![IngredientID] = lngIngredientID

Exit_IngredientID_DblClick:
Exit Sub

Err_IngredientID_DblClick:
MsgBox Err.Description
Resume Exit_IngredientID_DblClick
End Sub


Private Sub UnitID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub

Private Sub UnitID_DblClick(Cancel As Integer)
On Error GoTo Err_UnitID_DblClick
Dim lngUnitID As Long

If IsNull(Me![UnitID]) Then
Me![IngredientID].Text = ""
Else
lngUnitID = Me![UnitID]
Me![UnitID] = Null
End If
DoCmd.OpenForm "Units", , , , , acDialog, "GotoNew"
Me![UnitID].Requery
If lngUnitID <> 0 Then Me![UnitID] = lngUnitID

Exit_UnitID_DblClick:
Exit Sub

Err_UnitID_DblClick:
MsgBox Err.Description
Resume Exit_UnitID_DblClick
End Sub



--
///, ////
\ /, / >.
\ /, _/ /.
\_ /_/ /.
\__/_ <
/<<< \_\_
/,)^>>_._ \
(/ \\ /\\\
// ````
======((`=======

(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
 
J

Jeff Boyce

John

I don't know if it is relevant to your problem, but your code for the "Unit"
double-click refers to the textbox for Ingredient...

It is considered poor netiquette to "blast" your question to so many
newsgroups. Generally, most questions can be best handled in one (or maybe
two) 'groups.
 
F

Freeze

Fixed that error, but sadly no fix the problem.

I did not mean to blast the groups, and sorry for doing so.

Any other ideas?
Thanks Jeff

Jeff Boyce said:
John

I don't know if it is relevant to your problem, but your code for the "Unit"
double-click refers to the textbox for Ingredient...

It is considered poor netiquette to "blast" your question to so many
newsgroups. Generally, most questions can be best handled in one (or maybe
two) 'groups.

--
Good luck

Jeff Boyce
<Access MVP>

John Freeze said:
I am running Office97 patch 2.

I used the wizard to create a Recipe Database.
The person that I am making this for asked me to add in "Units Of Measure"
to the "Recipes Subform".
This was not a problem, but she wanted a pop up window like the
"Ingredients" table/form.
I created the table, form, and added in the following code (please see
below), but on a dbl click, nothing happens. When you dbl click on
ingredients, a new window opens.

Please any help would be greatly appreciated.
Thanks in advance.



Option Compare Database
Option Explicit

Private Sub IngredientID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub IngredientID_DblClick(Cancel As Integer)
On Error GoTo Err_IngredientID_DblClick
Dim lngIngredientID As Long

If IsNull(Me![IngredientID]) Then
Me![IngredientID].Text = ""
Else
lngIngredientID = Me![IngredientID]
Me![IngredientID] = Null
End If
DoCmd.OpenForm "Ingredients", , , , , acDialog, "GotoNew"
Me![IngredientID].Requery
If lngIngredientID <> 0 Then Me![IngredientID] = lngIngredientID

Exit_IngredientID_DblClick:
Exit Sub

Err_IngredientID_DblClick:
MsgBox Err.Description
Resume Exit_IngredientID_DblClick
End Sub


Private Sub UnitID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub

Private Sub UnitID_DblClick(Cancel As Integer)
On Error GoTo Err_UnitID_DblClick
Dim lngUnitID As Long

If IsNull(Me![UnitID]) Then
Me![IngredientID].Text = ""
Else
lngUnitID = Me![UnitID]
Me![UnitID] = Null
End If
DoCmd.OpenForm "Units", , , , , acDialog, "GotoNew"
Me![UnitID].Requery
If lngUnitID <> 0 Then Me![UnitID] = lngUnitID

Exit_UnitID_DblClick:
Exit Sub

Err_UnitID_DblClick:
MsgBox Err.Description
Resume Exit_UnitID_DblClick
End Sub



--
///, ////
\ /, / >.
\ /, _/ /.
\_ /_/ /.
\__/_ <
/<<< \_\_
/,)^>>_._ \
(/ \\ /\\\
// ````
======((`=======

(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
 
P

Penguin

From what I can see from your code you are try to assign a value to a
form once it is opened. This can be done from the NotInList instead of
prompting the user to Double-Click. Try looking at this example:

Private Sub City_NotInList(NewData As String, Response As Integer)
On Error Resume Next
Dim NewCategory As Integer
Beep
NewCategory = MsgBox("Do you wish to add a new city?", 36, "City
Not In List")
If NewCategory = 6 Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.OpenForm "frmZipCodesNew", , , , acFormAdd
Forms![frmZipCodesNew]![City] = NewData
Response = acDataErrContinue
Else
Response = acDataErrContinue
Me!City = Null
Me!City.SetFocus
MsgBox "Please select a city from the list.", , "Select City"
End If

End Sub

This example is from a database where the user enters a city which is
not found in the combo box. It prompts the user that the city was not
found and asks them if they want to add the city. This same code could
be changed to suit your needs.

Hope this helps


Fixed that error, but sadly no fix the problem.

I did not mean to blast the groups, and sorry for doing so.

Any other ideas?
Thanks Jeff

Jeff Boyce said:
John

I don't know if it is relevant to your problem, but your code for the "Unit"
double-click refers to the textbox for Ingredient...

It is considered poor netiquette to "blast" your question to so many
newsgroups. Generally, most questions can be best handled in one (or maybe
two) 'groups.

--
Good luck

Jeff Boyce
<Access MVP>

John Freeze said:
I am running Office97 patch 2.

I used the wizard to create a Recipe Database.
The person that I am making this for asked me to add in "Units Of Measure"
to the "Recipes Subform".
This was not a problem, but she wanted a pop up window like the
"Ingredients" table/form.
I created the table, form, and added in the following code (please see
below), but on a dbl click, nothing happens. When you dbl click on
ingredients, a new window opens.

Please any help would be greatly appreciated.
Thanks in advance.



Option Compare Database
Option Explicit

Private Sub IngredientID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub IngredientID_DblClick(Cancel As Integer)
On Error GoTo Err_IngredientID_DblClick
Dim lngIngredientID As Long

If IsNull(Me![IngredientID]) Then
Me![IngredientID].Text = ""
Else
lngIngredientID = Me![IngredientID]
Me![IngredientID] = Null
End If
DoCmd.OpenForm "Ingredients", , , , , acDialog, "GotoNew"
Me![IngredientID].Requery
If lngIngredientID <> 0 Then Me![IngredientID] = lngIngredientID

Exit_IngredientID_DblClick:
Exit Sub

Err_IngredientID_DblClick:
MsgBox Err.Description
Resume Exit_IngredientID_DblClick
End Sub


Private Sub UnitID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub

Private Sub UnitID_DblClick(Cancel As Integer)
On Error GoTo Err_UnitID_DblClick
Dim lngUnitID As Long

If IsNull(Me![UnitID]) Then
Me![IngredientID].Text = ""
Else
lngUnitID = Me![UnitID]
Me![UnitID] = Null
End If
DoCmd.OpenForm "Units", , , , , acDialog, "GotoNew"
Me![UnitID].Requery
If lngUnitID <> 0 Then Me![UnitID] = lngUnitID

Exit_UnitID_DblClick:
Exit Sub

Err_UnitID_DblClick:
MsgBox Err.Description
Resume Exit_UnitID_DblClick
End Sub



--
///, ////
\ /, / >.
\ /, _/ /.
\_ /_/ /.
\__/_ <
/<<< \_\_
/,)^>>_._ \
(/ \\ /\\\
// ````
======((`=======

(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
 
F

Freeze

This is what I tried, but had no luck :-(

Option Compare Database
Option Explicit

Private Sub Combo12_DblClick(Cancel As Integer)

End Sub

Private Sub IngredientID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub IngredientID_DblClick(Cancel As Integer)
On Error GoTo Err_IngredientID_DblClick
Dim lngIngredientID As Long

If IsNull(Me![IngredientID]) Then
Me![IngredientID].Text = ""
Else
lngIngredientID = Me![IngredientID]
Me![IngredientID] = Null
End If
DoCmd.OpenForm "Ingredients", , , , , acDialog, "GotoNew"
Me![IngredientID].Requery
If lngIngredientID <> 0 Then Me![IngredientID] = lngIngredientID

Exit_IngredientID_DblClick:
Exit Sub

Err_IngredientID_DblClick:
MsgBox Err.Description
Resume Exit_IngredientID_DblClick
End Sub

Private Sub UnitID_NotInList(NewData As String, Response As Integer)
On Error Resume Next
Dim NewCategory As Integer
Beep
NewCategory = MsgBox("Do you wish to add a new unit?", 36, "Unit Not In
List")
If NewCategory = 6 Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.OpenForm "Units", , , , acFormAdd
Forms![Units]![Unit] = NewData
Response = acDataErrContinue
Else
Response = acDataErrContinue
Me!Units = Null
Me!Units.SetFocus
MsgBox "Please select a unit from the list.", , "Select City"
End If

End Sub


Penguin said:
From what I can see from your code you are try to assign a value to a
form once it is opened. This can be done from the NotInList instead of
prompting the user to Double-Click. Try looking at this example:

Private Sub City_NotInList(NewData As String, Response As Integer)
On Error Resume Next
Dim NewCategory As Integer
Beep
NewCategory = MsgBox("Do you wish to add a new city?", 36, "City
Not In List")
If NewCategory = 6 Then
DoCmd.DoMenuItem acFormBar, acEditMenu, acUndo, , acMenuVer70
DoCmd.OpenForm "frmZipCodesNew", , , , acFormAdd
Forms![frmZipCodesNew]![City] = NewData
Response = acDataErrContinue
Else
Response = acDataErrContinue
Me!City = Null
Me!City.SetFocus
MsgBox "Please select a city from the list.", , "Select City"
End If

End Sub

This example is from a database where the user enters a city which is
not found in the combo box. It prompts the user that the city was not
found and asks them if they want to add the city. This same code could
be changed to suit your needs.

Hope this helps


Fixed that error, but sadly no fix the problem.

I did not mean to blast the groups, and sorry for doing so.

Any other ideas?
Thanks Jeff

John

I don't know if it is relevant to your problem, but your code for the "Unit"
double-click refers to the textbox for Ingredient...

It is considered poor netiquette to "blast" your question to so many
newsgroups. Generally, most questions can be best handled in one (or maybe
two) 'groups.

--
Good luck

Jeff Boyce
<Access MVP>

I am running Office97 patch 2.

I used the wizard to create a Recipe Database.
The person that I am making this for asked me to add in "Units Of Measure"
to the "Recipes Subform".
This was not a problem, but she wanted a pop up window like the
"Ingredients" table/form.
I created the table, form, and added in the following code (please see
below), but on a dbl click, nothing happens. When you dbl click on
ingredients, a new window opens.

Please any help would be greatly appreciated.
Thanks in advance.



Option Compare Database
Option Explicit

Private Sub IngredientID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub
Private Sub IngredientID_DblClick(Cancel As Integer)
On Error GoTo Err_IngredientID_DblClick
Dim lngIngredientID As Long

If IsNull(Me![IngredientID]) Then
Me![IngredientID].Text = ""
Else
lngIngredientID = Me![IngredientID]
Me![IngredientID] = Null
End If
DoCmd.OpenForm "Ingredients", , , , , acDialog, "GotoNew"
Me![IngredientID].Requery
If lngIngredientID <> 0 Then Me![IngredientID] = lngIngredientID

Exit_IngredientID_DblClick:
Exit Sub

Err_IngredientID_DblClick:
MsgBox Err.Description
Resume Exit_IngredientID_DblClick
End Sub


Private Sub UnitID_NotInList(NewData As String, Response As Integer)
MsgBox "Double-click this field to add an entry to the list."
Response = acDataErrContinue
End Sub

Private Sub UnitID_DblClick(Cancel As Integer)
On Error GoTo Err_UnitID_DblClick
Dim lngUnitID As Long

If IsNull(Me![UnitID]) Then
Me![IngredientID].Text = ""
Else
lngUnitID = Me![UnitID]
Me![UnitID] = Null
End If
DoCmd.OpenForm "Units", , , , , acDialog, "GotoNew"
Me![UnitID].Requery
If lngUnitID <> 0 Then Me![UnitID] = lngUnitID

Exit_UnitID_DblClick:
Exit Sub

Err_UnitID_DblClick:
MsgBox Err.Description
Resume Exit_UnitID_DblClick
End Sub



--
///, ////
\ /, / >.
\ /, _/ /.
\_ /_/ /.
\__/_ <
/<<< \_\_
/,)^>>_._ \
(/ \\ /\\\
// ````
======((`=======

(e-mail address removed)
(e-mail address removed)
(e-mail address removed)
 
F

Freeze

FOUND the problem. :) Thanks to those that tried to help :) I had the name
wrong for the Combo Window. It was named Combo13 instead of UnitID.

Thanks again all.
 
J

John Freeze

FOUND the problem. :) Thanks to those that tried to help :) I had the name
wrong for the Combo Window. It was named Combo13 instead of UnitID.

Thanks again all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Goto tab page on double click 0
TabCtl 1
How to update control 3
Add a Duplicate Record 5
Double-click to add not working 10
Not in List Event 4
Problem with Insert 2
BuildFilter 2

Top