Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Text List Box

Status
Not open for further replies.

ankurmisra

Technical User
Jun 27, 2005
18
US
I need to make a list box, but leave the feilds blank, so when the user access the form he/she enters text presses enter and the item is stored but is able to enter another as he/she pleases.

For Example the form would look like the following:

Requested Item(s): Data Report 1 (hit enter & the item stores)
(option of)Data Report 2
 
Hi, ankurmisra,

Take a look at the AddItem method of the listbox object.

Ken S.
 
Thanks for the reply Ken. I went to the desifn view of the form and added a list box but can't figure out how to get or go about the addItem method. thanks for the help.
 
Hi!

It sounds like you actually want to use a combo box. You can set the AutoExpand to Yes and Limit to List to yes. Then, as the user types in the combo box, Access will pop up first match in its list and, if the user types in something not on the list, it will trigger the Not in list event where you can capture what was typed in and store it in the row source of the combo box. There are FAQs on this site which will show you the code you need to do this.

hth


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Thanks Jeff,

It looks like its on the right path. But it still isnt quite working. I have tghe combo box and am able to type in it but when i hit enter it tells me

The Text you entered ins't and item on the list.

Select an item from the list, or enter text that matches one of the listed items.

I changed the Auto Expand and the limit to list to yes and i know that i am alost there if i can just get over this, is there anything else i need to change?
 
I think this is what i Need to add:

it will trigger the Not in list event where you can capture what was typed in and store it in the row source of the combo box. There are FAQs on this site which will show you the code you need to do this.

I am a first time user of this forum thanks for all your help!
 
Why not simply use a continuous or datasheet subform ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
I don't know ill give it a shot. Im not an expert tho, can you maybe tell me how to use it?
 
I just tried messing around with the subform and do not know how to use it. The combo box Idea was exacly what i need to do. I am preety close I searched for the faq but there seems to be a lot and not directed to this. Once again I am a first time user of this forum and your help is greatly appreciated.
 
The combo box Idea was exacly what i need to do
So, in the VBA help file have a look at the NotInList event.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
sweet i am doing that now, i just can't figure out what the right name of my form is I changed the combo box name and it works til it gets to the name of my form in the code then it doesnt recognize it. This is preety basic question but how can i find out what my form name is for the vba portion.
 
arghh, cant figure out what the form is called for vba

Its Data Request List ive tried a number of diff options!!
 
Yeah it version 2003

frmData Request List
frmData_Request_List
formData_Request_List
Data Request List
Data_Request_List
and others like this

This is my code in caps is my problem:
Private Sub Request_Item_s___NotInList(NewData As String, Response As Integer)
If MsgBox("Add to List?", vbYesNo, "Warning") = vbYes Then
DoCmd.OpenForm "formData_Request_List --PROBLEM, NAME???", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
End If
End Sub
 
Replace this:
"formData_Request_List --PROBLEM, NAME???"
By something like this:
"name of the data entry form as it appears in the database window"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Form_Data Request List is how it is in the window to the left, i even tried using other forms but the same error keeps popping up. I am 99% it the right name now but why an I still gettin the errors?
 
in the window to the left
When in VBE ?
So try this:
"Data Request List"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Thanks PHV,

Ok I got rid of that error but the program is not working.
What happens is I type in the item i wanna add then hit enter. I get the prompt Add item, I click yes and the orignal thing comes: The text you entered isnt an item in the list.

Please contine to help, Thank you very much.

This is my code:
Private Sub Request_Item_s___NotInList(NewData As String, Response As Integer)
If MsgBox("Add to List?", vbYesNo, "Add") = vbYes Then
DoCmd.OpenForm "Data Request List", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
End If
End Sub


Private Sub Form_Open(Cancel As Integer)
If IsNull(Me.OpenArgs) Then
Else
cmdAddNew_Click
Request_Item_s = Me.OpenArgs
End If
End Sub

Private Sub cmdAddNew_Click()
On Error GoTo Err_cmdAddNew_Click

DoCmd.GoToRecord , , acNewRec

Exit_cmdAddNew_Click:
Exit Sub

Err_cmdAddNew_Click:
MsgBox Err.Description
Resume Exit_cmdAddNew_Click

End Sub


 
i didnt read this part in the FAQ

where you wish to limit the user to choosing entries from the list,

i dont think that would make a difference altho i did add it and try

The later part of this statment is what i was hoping to accomplish -> but allow the user the option to add new entries to the list.

from this FAQ, which the above code is from as well. ence even
 
Nevermind, my supervisor just told me something different. I just need to add the item in the database. so i think i am just going to use a simple text box. thanks for all the help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top