By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,647 Members | 1,433 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,647 IT Pros & Developers. It's quick & easy.

is there a way to set a fields default value based on a filter

P: n/a
I am trying to set the default value on a forms field to the filter
that I am passing to the form.
The filter works fine but the field comes up blank.
So I put in a default value and it works fine. But I need to change
the default value for the field each time I pass it a filter.

so on the switchboard I build for this mess I have 8 buttons and each
button does this

On Error GoTo Err_Command0_Click

Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "[timeframe] = 'Baseline'"

stDocName = "FormCompetitiveFoods4"
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command0_Click:
Exit Sub

Err_Command0_Click:
MsgBox Err.Description
Resume Exit_Command0_Click
and filters on the timeframe but the combo box I am replacing (now a
text box) needs to have Baseline as its default so they will never
have to touch that pull down..

=============================================
wHY ??

we have a form with a pulldown that has 8 values...
OH NO not a pull down.
make 8 forms ,,,1 for each value

PLEASEEEE dont ask...these people are idiots
we have 12000 employees and I get stuck with any idiot that no one
else can work with.

ask me real nice and I will tell you about the next thing I am having
to do ROFL
Feb 14 '07 #1
Share this Question
Share on Google+
2 Replies


P: n/a
"sparks" <js******@swbell.netwrote

Look at Help for DoCmd.OpenForm... pass the Timeframe, also in the OpenArgs
argument. In the Form's Load Event, set that value into the Default Value of
the Control... something like:

Me.txtTimeframe.DefaultValue = Me.OpenArgs
we have 12000 employees and I get stuck
with any idiot that no one else can work with.
There's a lot of that going around, and it's been going on for as long as
there's been business, ever since strangling the idiots became a prohibited
activity.

<CHUCKLE But, take heart, you get them because you are such a nice guy.

One question: How is it that this person is not only telling you what they
want done, but how you have to implement it? Is he/she your boss?

I recall one instance when I was asked to advise a colleague how to
implement something; then the boss told him, "No, do it this way, it'll run
faster." Not only did his way not work as hoped, it corrupted the
production database, proving one more time the old adage, "If it doesn't
work, it doesn't matter how fast it runs."

Larry Linson
Microsoft Access MVP
Feb 15 '07 #2

P: n/a

Thank you for the help I will try this right now.
THANKS BIG TIME for the chuckle it made me feel better.

get this one

they are entering students

date teacher name student name

the teacher name filters the list in student name
ok we don't want to have to change each time we put in a student.
THIS sounded reasonable, just change the student name and generate a
new record with the same date as they have entered (unbound box for
each of these)
so just change the student and fill in the record...pick new student
and next record.

BUT we also want to at any time want to change teacher I explained
that you change teacher and the new student list would be generated
and you pick a student and continue.

Date on the other hand is a problem..you change the date...did you
mean to change the date of the record you are working on or did you
put in a new date so you could pick a teacher and student for a new
record....The database has no way of knowing.
Look if it all goes to hell and you enter the wrong things how are you
going to change it? I take no responsibility on forcing values and new
records so someone doesn't have to put in the data.

Just like the pull down list of what you are putting in ...thats too
much work make it so its always what we want...how are you going to
change (edit an incorrect record) its no longer changable...delete the
record and put it in the right way

WELL you can't design anything can you! We need to get someone up here
that knows what a database should be and how to design it.

That was yesterday after the thing I was describing below.

I am looking for a new job...this is beyond stupid, or is it me?

again thanks for all your help

On Thu, 15 Feb 2007 08:19:40 GMT, "Larry Linson"
<bo*****@localhost.notwrote:
>"sparks" <js******@swbell.netwrote

Look at Help for DoCmd.OpenForm... pass the Timeframe, also in the OpenArgs
argument. In the Form's Load Event, set that value into the Default Value of
the Control... something like:

Me.txtTimeframe.DefaultValue = Me.OpenArgs
we have 12000 employees and I get stuck
with any idiot that no one else can work with.

There's a lot of that going around, and it's been going on for as long as
there's been business, ever since strangling the idiots became a prohibited
activity.

<CHUCKLE But, take heart, you get them because you are such a nice guy.

One question: How is it that this person is not only telling you what they
want done, but how you have to implement it? Is he/she your boss?

I recall one instance when I was asked to advise a colleague how to
implement something; then the boss told him, "No, do it this way, it'll run
faster." Not only did his way not work as hoped, it corrupted the
production database, proving one more time the old adage, "If it doesn't
work, it doesn't matter how fast it runs."

Larry Linson
Microsoft Access MVP
Feb 15 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.