473,386 Members | 1,793 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

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

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
2 2286
"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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Stewart Allen | last post by:
I'm trying to filter a table that has 2 date fields, the first date will always have a value but the second will only occasionally has a value. Each date field also has a corresponding text field...
2
by: Cro | last post by:
Dear Access Developers, I am developing a form with 'default view' set to "continuous forms". I am suffering with a problem I can't yet see a solution too. Each record has many fields. Two...
1
by: Wayne | last post by:
I'm using the following code from the Access Web to open a folder. The folder opens in "List" View. Is there an addition that I can make to the code to force the folder to open in "Details" view?...
6
by: Brian | last post by:
Hello, Basically, I'm running a query on a form's activation, and I'd like to have the results of the query be placed into other fields on the same form automatically. Does anybody know how...
2
by: fstenoughsnoopy | last post by:
I have a customer order database and I need to pull a customers information, ie first name, last name, address, city, state, zip, phone, etc, into the oder table. i don't know how to go about...
9
by: dee | last post by:
I'd like to filter by the following criteria: left(LeadDisposition,3) = "Sit" AND Appt_Date = Text767 I have no idea how to do this. Appreciate help.
10
by: Eirik Eldorsen | last post by:
How can I 301 redirect www.example.com/default.aspx to www.example.com without using ISAPI filters?
1
by: G04 | last post by:
Hi All, I have a continuous form with all records. For each field there is a combo in the form header and the form also contains a Toggle button "Apply Filter". When clicked, it changes to...
12
by: Studiotyphoon | last post by:
Hi, I have report which I need to print 3 times, but would like to have the following headings Customer Copy - Print 1 Accounts Copy - Print 2 File Copy -Print 3 I created a macro to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.