Problem with Default Value in Form Text Box

G

Guest

I am having a problem setting the default value for a text box in a form. I
have 8 forms; each form applies to a certain category name. I want a text
box in the form to have a default value of the category name, so that the
user does not have to type anything it will just populate to the categoryname
field in the table, I am going to lock the field so it can not be changed.
When I set the default value property for the textbox inside the form design
view, nothing shows up (in the form or in the table) No matter what I try I
keep getting blank values in the categoryname field.
I can't set the default value in the Table Design because it has multiple
values.
I'm not for sure if this makes sense or if I have a bad design idea, I am
fairly new to access. Any help would be greatly appreciated
 
G

Guest

A couple of questions.
How do you select which of the 8 forms to open?
Once the form is open, how does it know what category it belongs to?
Are all 8 forms using the same table, just with a different category?
How are you trying to set the default value, currently?
 
G

Guest

I have each of the eight forms saved as the category names. The user opens
the category they want to enter a record for, through a switchboard. The user
knows what category the form belongs to by its title and the switchboard. So
the user doesn't even need to see the text box with the category name in it,
I just want the category name to be entered into the table with every record.
So for each form I will have a text box with a different default value (One
form as one default category) All eight forms use the same table, I need
each form's text box to populate the CategoryName field with the default
value. Currently, I have a field set as text, I create a text box in each
form which is bound to the CategoryName field. In each form I go to the text
box's property, in the default value box, I enter the appropriate name with
quotes that I need in the text box. I get no errors, nothing happens at all.
The form text box is blank and the field in the table is blank, it seems to
accept the expressions, but no fields ever populate. I have tried numerous
other ways, with lookups to create a list box and trying to set the default
value that way but i always have to click on the name to get it to populate
the field, I am trying to avoid that. Hopefully my rambling isn't
confusing and makes sense. Thanks for the reply and any addtional help would
be of great help.
 
G

Guest

There is one statement in your post that concerns me:
"in the default value box, I enter the appropriate name with
quotes that I need in the text box. "

Are you saying you are trying to include quote marks (") in text box or do
you mean you are enclosing the category name in qoute marks?

I am still not certain what is happening, but there are some possibilities
to explore. Are you opening the form in Data Entry mode or in Edit Mode? If
I am not mistaken, the Switchboard opens forms based on whether you select
Data Entry mode or Edit mode in the Switchboard manager, not what the default
mode of the form is set to.

Also, the Default Value property only applies to new records.

I would try opening one of the forms from the database window rather than
from the switchboard to see what happens.

As to my question regarding categories, what I am thinking is if there is a
way to use only one form and pass the form the category when it loads rather
than having to maintain 8 copies of the same thing. So, the question really
was how the user selects a category. I think from what you said, it is based
on which button they click on the switchboard.

Post back with exactly what you put in the text box, please.
 
M

missinglinq via AccessMonster.com

"I go to the text box's property, in the default value box, I enter the
appropriate name with
quotes that I need in the text box"

Sounds like what you're entering in Default Value is:

"My Category"

What you need to enter here is the equal sign followed by your desired value:

= "My Category"
 
G

Guest

Not really.
If you type in Category, Access will put the qoutes around it and it will
come out
"Category"

It works just fine with or without the =
(2003)

I have 4 cats, where shall we start?
 
G

Guest

Thanks for all the help so far, I really appreciate it, as I am fairly new to
Access. As for my problem, I don't need the quotes in my default value.
Access was putting the quotes in for me when I move off the default value
field. So I don't believe I am having a problem with that. I have opened the
form in design view from the database view and from the switchboard manager.
I do believe I have the form to be opened up in data entry mode, does that
affect how the design mode works? As for using the same form and just
switching the categories, that might be a possiblity, most of the fields are
the same for each category but there are a few different for each one. I
want to the user to have to select a category to avoid any errors.
Navigation through the switchboard is where I want the category selection to
happen and then the category field in the table to be populated after the
form opens up, or at least when the go to enter a new record. This seems
strange to me because it seems like all I should have to do is create a text
box on the form, set the default value and when a new record is started that
value will be used in the appriopriate field that I bound it too. Nothing
is ever that easy though. Any more help would be great. Thanks
 
G

Guest

The default value property is designed and does do exactly what you are
describing. There is something else going on that is creating the problem.
Have you tried opening the form directly from the database window rather than
going through the switchboard? Switchboards can sometimes do funny things to
forms.
 
G

Guest

I have opened through both and tried setting it both ways. I guess I'll try
deleting the switchboard since that is easy to recreate and just work with
the forms, maybe create a new form through the wizard and see if it works
through there. Sound like a good option? Thanks again for your help, I'll
let you know if that helps at all.
 
G

Guest

I got it figured out now with some help. I had the categoryname field in the
table spelled catergoryname, and the control source was set to categoryname.
In the form properties under the Oncurrent event I was instructed to add
me.categoryname = "test" and that worked. It enters the text into the
textbox with every new record.
Thanks for your help
 

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


Top