Letting users add to Combo Boxes

  • Thread starter Thread starter Newf via AccessMonster.com
  • Start date Start date
N

Newf via AccessMonster.com

Good day!
I'm looking for help with regards to cmb boxes. I have a combo box set up
with a table that the user has to select their name (so people know who
updated record). Is there a way I can set it up so I can let them add a new
user to the cmb box??

Thanks in advance...

Newf
~Everyone needs a NEWFIE as a friend~
 
Lard tunderin' Jesus, bye
Are ye a Townie or a Bayman?

ye'll be after usin' the Not In List event. VBA Help has a good example.
 
110% Townie... U?? An East Coaster???

I do not have the VBA help and did a bit of searching and could not find it
online. So in the On Not in List what will I be placing in there???

Newf
~Everyone needs a NEWFIE as a friend~





Lard tunderin' Jesus, bye
Are ye a Townie or a Bayman?

ye'll be after usin' the Not In List event. VBA Help has a good example.
Good day!
I'm looking for help with regards to cmb boxes. I have a combo box set up
[quoted text clipped - 6 lines]
Newf
~Everyone needs a NEWFIE as a friend~
 
Here is the example from VBA Help:

Private Sub Colors_NotInList(NewData As String, _
Response As Integer)
Dim ctl As Control

' Return Control object that points to combo box.
Set ctl = Me!Colors
' Prompt user to verify they wish to add new value.
If MsgBox("Value is not in list. Add it?", _
vbOKCancel) = vbOK Then
' Set Response argument to indicate that data
' is being added.
Response = acDataErrAdded
' Add string in NewData argument to row source.
ctl.RowSource = ctl.RowSource & ";" & NewData
Else
' If user chooses Cancel, suppress error message
' and undo changes.
Response = acDataErrContinue
ctl.Undo
End If
End Sub

Note that it is necesssary to set the combo's Limit To List property to Yes,
or the event will not fire.

I spent several years in Newfoundland in the early '60s. For a portion of
that, U.S. Navy stationed at Argentia. Then I stayed in St. John's and
played in bands for a while. Newfoundland is my second favorite place in the
world, The first being Texas. Knowing and loving you Newfs, I have often
said that Newfs are the Texans of Canada, fiercely independant, unbelievabley
friendly, and each is a character.


Newf via AccessMonster.com said:
110% Townie... U?? An East Coaster???

I do not have the VBA help and did a bit of searching and could not find it
online. So in the On Not in List what will I be placing in there???

Newf
~Everyone needs a NEWFIE as a friend~





Lard tunderin' Jesus, bye
Are ye a Townie or a Bayman?

ye'll be after usin' the Not In List event. VBA Help has a good example.
Good day!
I'm looking for help with regards to cmb boxes. I have a combo box set up
[quoted text clipped - 6 lines]
Newf
~Everyone needs a NEWFIE as a friend~
 
I have placed the code in the On Not in List Event and theres eems to be
nothing happening. The combo's Limit To List property is set to YES.

I have changed Colors to name of my combo field - frm_cmb_Verification.

So you were with the US Military? Kewl. The US still sends NAVY up to St.
John's now for Ice Berg watch. Newfoundland is a great spot and I wish to
move back there some day.


Here is the example from VBA Help:

Private Sub Colors_NotInList(NewData As String, _
Response As Integer)
Dim ctl As Control

' Return Control object that points to combo box.
Set ctl = Me!Colors
' Prompt user to verify they wish to add new value.
If MsgBox("Value is not in list. Add it?", _
vbOKCancel) = vbOK Then
' Set Response argument to indicate that data
' is being added.
Response = acDataErrAdded
' Add string in NewData argument to row source.
ctl.RowSource = ctl.RowSource & ";" & NewData
Else
' If user chooses Cancel, suppress error message
' and undo changes.
Response = acDataErrContinue
ctl.Undo
End If
End Sub

Note that it is necesssary to set the combo's Limit To List property to Yes,
or the event will not fire.

I spent several years in Newfoundland in the early '60s. For a portion of
that, U.S. Navy stationed at Argentia. Then I stayed in St. John's and
played in bands for a while. Newfoundland is my second favorite place in the
world, The first being Texas. Knowing and loving you Newfs, I have often
said that Newfs are the Texans of Canada, fiercely independant, unbelievabley
friendly, and each is a character.
110% Townie... U?? An East Coaster???
[quoted text clipped - 14 lines]
 
You have to type some value in the combo that is not in the combo's row
source. It will not fire if you drop down.

So where are you now? Are you a Native Newf?

Newf via AccessMonster.com said:
I have placed the code in the On Not in List Event and theres eems to be
nothing happening. The combo's Limit To List property is set to YES.

I have changed Colors to name of my combo field - frm_cmb_Verification.

So you were with the US Military? Kewl. The US still sends NAVY up to St.
John's now for Ice Berg watch. Newfoundland is a great spot and I wish to
move back there some day.


Here is the example from VBA Help:

Private Sub Colors_NotInList(NewData As String, _
Response As Integer)
Dim ctl As Control

' Return Control object that points to combo box.
Set ctl = Me!Colors
' Prompt user to verify they wish to add new value.
If MsgBox("Value is not in list. Add it?", _
vbOKCancel) = vbOK Then
' Set Response argument to indicate that data
' is being added.
Response = acDataErrAdded
' Add string in NewData argument to row source.
ctl.RowSource = ctl.RowSource & ";" & NewData
Else
' If user chooses Cancel, suppress error message
' and undo changes.
Response = acDataErrContinue
ctl.Undo
End If
End Sub

Note that it is necesssary to set the combo's Limit To List property to Yes,
or the event will not fire.

I spent several years in Newfoundland in the early '60s. For a portion of
that, U.S. Navy stationed at Argentia. Then I stayed in St. John's and
played in bands for a while. Newfoundland is my second favorite place in the
world, The first being Texas. Knowing and loving you Newfs, I have often
said that Newfs are the Texans of Canada, fiercely independant, unbelievabley
friendly, and each is a character.
110% Townie... U?? An East Coaster???
[quoted text clipped - 14 lines]
Newf
~Everyone needs a NEWFIE as a friend~

--
Newf
~Everyone needs a NEWFIE as a friend~

Message posted via AccessMonster.com
 
Ok. I have that fixed now. Is there a way to let them enter into the combo
box so it will get stored into the table for next time??
And if they choose the drop down and not notice their name there they can't
enter? Is that correct??

I'm an original Newf. Lived there for 25 yrs and moved to Ottawa in 2000. All
family is back there and I tend to go back once a yr. Have u been back there
since?? And playing in a band you must of tinkered with George Street a fair
bit ;) !


You have to type some value in the combo that is not in the combo's row
source. It will not fire if you drop down.

So where are you now? Are you a Native Newf?
I have placed the code in the On Not in List Event and theres eems to be
nothing happening. The combo's Limit To List property is set to YES.
[quoted text clipped - 44 lines]
 
I haven't been back since about 1990 - 91. George St. was not what it is now
back in the old days. Most of the clubs were more in the older section of
town, but I don't remember exactly where, now. Some of the club names I
remember (but are most likely long gone)
The HorseShoe, The Old Mill, The Continental, man, I can't even remeber most
of them.
I was suprised to see George street had become party central when I was
there last.

Here is what you are asking about:

Private Sub cboActivity_NotInList(NewData As String, Response As Integer)
Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If

End Sub




Newf via AccessMonster.com said:
Ok. I have that fixed now. Is there a way to let them enter into the combo
box so it will get stored into the table for next time??
And if they choose the drop down and not notice their name there they can't
enter? Is that correct??

I'm an original Newf. Lived there for 25 yrs and moved to Ottawa in 2000. All
family is back there and I tend to go back once a yr. Have u been back there
since?? And playing in a band you must of tinkered with George Street a fair
bit ;) !


You have to type some value in the combo that is not in the combo's row
source. It will not fire if you drop down.

So where are you now? Are you a Native Newf?
I have placed the code in the On Not in List Event and theres eems to be
nothing happening. The combo's Limit To List property is set to YES.
[quoted text clipped - 44 lines]
Newf
~Everyone needs a NEWFIE as a friend~

--
Newf
~Everyone needs a NEWFIE as a friend~

Message posted via AccessMonster.com
 
Thanks.. Will try this out..

One of them are still around -Old Mill (Brookfield Road?). Yeah, George St is
the party spot now. It has the most pubs per square foot of any street in
North America.

Thanks for the help!! Will let you know if it works!

Newf
I haven't been back since about 1990 - 91. George St. was not what it is now
back in the old days. Most of the clubs were more in the older section of
town, but I don't remember exactly where, now. Some of the club names I
remember (but are most likely long gone)
The HorseShoe, The Old Mill, The Continental, man, I can't even remeber most
of them.
I was suprised to see George street had become party central when I was
there last.

Here is what you are asking about:

Private Sub cboActivity_NotInList(NewData As String, Response As Integer)
Dim rst As Recordset

If MsgBox(NewData & " Is Not In The Attribute Table " & vbNewLine _
& "Do you want to add it", _
vbInformation + vbYesNo, "Not Found") = vbYes Then
CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " _
& "VALUES ('" & NewData & "');"), dbFailOnError
Me.Requery
Set rst = Me.RecordsetClone
rst.FindFirst "[Activity] = '" & NewData & "'"
Me.Bookmark = rst.Bookmark
Set rst = Nothing
Me.txtDescription.SetFocus
Response = acDataErrAdded
Else
Me.cboActivity.Undo
Response = acDataErrContinue
End If

End Sub
Ok. I have that fixed now. Is there a way to let them enter into the combo
box so it will get stored into the table for next time??
[quoted text clipped - 16 lines]
 
I am wondering what the - CurrentDb.Execute ("INSERT INTO CISAttributeTable
(ACTIVITY) " - (ACTIVITY) is???
Also the [activity] here - rst.FindFirst "[Activity] = '" & NewData & "'" -
is????

Newf

Thanks.. Will try this out..

One of them are still around -Old Mill (Brookfield Road?). Yeah, George St is
the party spot now. It has the most pubs per square foot of any street in
North America.

Thanks for the help!! Will let you know if it works!

Newf
I haven't been back since about 1990 - 91. George St. was not what it is now
back in the old days. Most of the clubs were more in the older section of
[quoted text clipped - 34 lines]
 
Wow, The Old Mill really is Old. It was an old place when I was there. I
thought I had heard it burned down. Is is possible that they rebuilt it?

It would make sense that George St. has the most pubs per square foot, St.
John's has the most drunks per square foot :)

I actually knew a guy in St. John's that to give him directions to any place
in town, the ony way he would understand is if you told him where it was in
relation to the nearest pub. "Come out of the Horse Shoe, turn left. It's
on the right, two blocks up"

CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " - (ACTIVITY)
The INSERT INTO part is an SQL statement that adds a new record to the table
and populates the fields in the SQL with a value.
CurrentDb.Execute is much like the Docmd.RunSQL, only better and faster.

[Activity] is the primary key in the table
NewData is the value that was typed into the combo.

What this is doing is making the newly created record the current record in
the form.

Newf via AccessMonster.com said:
I am wondering what the - CurrentDb.Execute ("INSERT INTO CISAttributeTable
(ACTIVITY) " - (ACTIVITY) is???
Also the [activity] here - rst.FindFirst "[Activity] = '" & NewData & "'" -
is????

Newf

Thanks.. Will try this out..

One of them are still around -Old Mill (Brookfield Road?). Yeah, George St is
the party spot now. It has the most pubs per square foot of any street in
North America.

Thanks for the help!! Will let you know if it works!

Newf
I haven't been back since about 1990 - 91. George St. was not what it is now
back in the old days. Most of the clubs were more in the older section of
[quoted text clipped - 34 lines]
Newf
~Everyone needs a NEWFIE as a friend~

--
Newf
~Everyone needs a NEWFIE as a friend~

Message posted via AccessMonster.com
 
I was wondering what is the (ACTIVITY) representing?? Table?? Query??

And the [activity] is the prime key.

They must of re-built or named another bar that name. Not sure of the druks
in the day time but in the night - WOW!! A street party EVERY weekend - Rain,
Sleet or Snow!!

Newf
Wow, The Old Mill really is Old. It was an old place when I was there. I
thought I had heard it burned down. Is is possible that they rebuilt it?

It would make sense that George St. has the most pubs per square foot, St.
John's has the most drunks per square foot :)

I actually knew a guy in St. John's that to give him directions to any place
in town, the ony way he would understand is if you told him where it was in
relation to the nearest pub. "Come out of the Horse Shoe, turn left. It's
on the right, two blocks up"

CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " - (ACTIVITY)
The INSERT INTO part is an SQL statement that adds a new record to the table
and populates the fields in the SQL with a value.
CurrentDb.Execute is much like the Docmd.RunSQL, only better and faster.

[Activity] is the primary key in the table
NewData is the value that was typed into the combo.

What this is doing is making the newly created record the current record in
the form.
I am wondering what the - CurrentDb.Execute ("INSERT INTO CISAttributeTable
(ACTIVITY) " - (ACTIVITY) is???
[quoted text clipped - 18 lines]
 
Activity is a field in my recordset. This database does project accounting.
All costs are associated to an Activity.

Speaking of fires, Have they ever rebuilt Chess' ?
There was never better fish & chips on the planet. When I took my wife to
visit Newfoundland in about 90-91, I told her we were going to go there. I
said the place was a dump but had the best fish & chips that could be found.
She agreed.

Newf via AccessMonster.com said:
I was wondering what is the (ACTIVITY) representing?? Table?? Query??

And the [activity] is the prime key.

They must of re-built or named another bar that name. Not sure of the druks
in the day time but in the night - WOW!! A street party EVERY weekend - Rain,
Sleet or Snow!!

Newf
Wow, The Old Mill really is Old. It was an old place when I was there. I
thought I had heard it burned down. Is is possible that they rebuilt it?

It would make sense that George St. has the most pubs per square foot, St.
John's has the most drunks per square foot :)

I actually knew a guy in St. John's that to give him directions to any place
in town, the ony way he would understand is if you told him where it was in
relation to the nearest pub. "Come out of the Horse Shoe, turn left. It's
on the right, two blocks up"

CurrentDb.Execute ("INSERT INTO CISAttributeTable (ACTIVITY) " - (ACTIVITY)
The INSERT INTO part is an SQL statement that adds a new record to the table
and populates the fields in the SQL with a value.
CurrentDb.Execute is much like the Docmd.RunSQL, only better and faster.

[Activity] is the primary key in the table
NewData is the value that was typed into the combo.

What this is doing is making the newly created record the current record in
the form.
I am wondering what the - CurrentDb.Execute ("INSERT INTO CISAttributeTable
(ACTIVITY) " - (ACTIVITY) is???
[quoted text clipped - 18 lines]
Newf
~Everyone needs a NEWFIE as a friend~
 
Back
Top