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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how to prefill combobox with "Y" and "N" and "C"

Status
Not open for further replies.

pinstripe

Programmer
Dec 27, 2004
52
when the combobox is pulled down you should see those values
The values are not comming from no table - so how do i fill this in ?
 
Bring Properties of combobox and set
RowSource Type = ValueList
RowSource = "USA";"INDIA";FRANCE"
HTH

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
How are ya pinstripe . . . .

Set the following properties for the comboboc:
[ol][blue][li]Row Source Type [purple]Value List[/purple][/li]
[li]Row Source [purple]"Y";"N";"C"[/purple][/li]
[li]Column Count [purple]1[/purple][/li][/blue][/ol]
[blue]Thais it! . . .[/blue]

For future reference remember [blue]Value List[/blue] is limited to [purple]2k (2048)[/purple] characters. That includes semicolons . . .

Calvin.gif
See Ya! . . . . . .
 
thank you it works great

another simple question
how to save a query as table (to get new table)
couse it gives me just as form as report or as query
 
While you are at the design view of the query
Menu Query > Make Table Query > Follow the instructions
also look for "Create a table from another table with a query"
or "Make Table Query" in the help file
regards

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
thanks ZmrAbdulla

just one more question

when the user enters the data (description of item) in the textbox it is ok to enter characters like (&/" " ' : ; ) but i am geting the errors beacouse of that
what would be a solution for this ?

 
What error you are getting?

Zameer Abdulla
Jack of Visual Basic Programming, Master in Dining & Sleeping
Visit Me
 
Depending on how you update. If it's a bound form, it shouldn't give errors. If you update through dynamic sql, it will. If you're using DAO:

[tt]"update sometable set somefield = """ & me!txtBox & """"[/tt]

Only short snippet to demonstrate the concept of doublequoting, which works in DAO for special characters

As stated by ZmrAbdulla, it is hard to guess if we do not know what and how you are doing stuff, so unless you post more details, we're only guessing...

Have a look at faq181-2886, in relation to this, perhaps in particular #14, but the whole faq is worth a read;-)

Roy-Vidar
 
yes, you are right
the error is:

Run-time error '3075'

syntax error (missing operator) in query expression (here is puted a contain of the textbox)

code:
on_click event

DoCmd.SetWarnings False

DoCmd.RunSQL "INSERT INTO [Table L1] ([Catalog Description]) VALUES ('" & Me.[Catalog Description] & "');"

DoCmd.SetWarnings True

thx
 
Did you try doublequoting?

[tt]"INSERT INTO [Table L1] ([Catalog Description]) VALUES (""" & Me.[Catalog Description] & """)"[/tt]

Roy-Vidar
 
thx RoyVidar
i was absent for few days...
i will try that- hopeffuly it will work

 
Double quoting doesn't suffice if Me.[Catalog Description] contains ".
If ac2k or above you may consider this:
DoCmd.RunSQL "INSERT INTO [Table L1] ([Catalog Description]) VALUES ('" & Replace(Me.[Catalog Description], [tt]"'", "''"[/tt]) & "')"

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
yes you are right PHV --> it works
thank you both
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top