473,386 Members | 1,606 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.

Updating Yes/No Fields !

In a small Contacts Database, I have 6 Boolean(Yes/No) Fields so that
6 individuals in the company can maintain their own private mailing
list.

The names of the fields are as follows:
Commander
Iyer
Finance
Suresh
Jessie
General

I also have another Yes/No field called MARKED.

When the user selects one of the above 6 names in a combo box on my
form, I would like the MARKED field to get replaced with a YES for
each YES in the 6 Fields.

eg. if the user clicks COMMANDER, the MARKED field should get marked
with a YES for each YES in the COMMANDER field. Similarly with all the
other fields.

Can anyone please suggest how to go about doing this.

Thx & Best Rgds,
Prakash
Nov 12 '05 #1
6 4101
The only way I see doing this is with code. I hope I understand you
correctly.

On the "After Update" event of the combo box invoke the Code Builder and
type this:
(I am going to use cboUser as the combo box name)

Select Case cboUser.Value
Case "Commander"
[Commander] = vbYes
[Marked] = vbYes
Case "Iyer"
[Iyer] = vbYes
[Marked] = vbYes
Case "Finance"
[Finance] = vbYes
[Marked] = vbYes
Case "Suresh"
[Suresh] = vbYes
[Marked] = vbYes
Case "Jessie"
[Jessie] = vbYes
[Marked] = vbYes
Case "General"
[General] = vbYes
[Marked] = vbYes
End Select

Hope that helps!
On 13 Dec 2003 13:50:19 -0800, Prakash Wadhwani <si****@omantel.net.om>
wrote:
In a small Contacts Database, I have 6 Boolean(Yes/No) Fields so that
6 individuals in the company can maintain their own private mailing
list.

The names of the fields are as follows:
Commander
Iyer
Finance
Suresh
Jessie
General

I also have another Yes/No field called MARKED.

When the user selects one of the above 6 names in a combo box on my
form, I would like the MARKED field to get replaced with a YES for
each YES in the 6 Fields.

eg. if the user clicks COMMANDER, the MARKED field should get marked
with a YES for each YES in the COMMANDER field. Similarly with all the
other fields.

Can anyone please suggest how to go about doing this.

Thx & Best Rgds,
Prakash


--
"Justo, we have a problem!"
If you want to send email, you may do so at:
newsgroup at jwhap dot com
Nov 12 '05 #2
Thx Justo ... I think I did'nt get myself across correctly.

What I'd like is that when the user selects COMMANDER, I'd like to run
an SQL Statement changing all MARKED to YES for each COMMANDER=YES.

Hope you can help me.

Thx & Best Rgds,
Prakash.


Justo <ne*******@noemail.com> wrote in message news:<op**************@news.la.sbcglobal.net>...
The only way I see doing this is with code. I hope I understand you
correctly.

On the "After Update" event of the combo box invoke the Code Builder and
type this:
(I am going to use cboUser as the combo box name)

Select Case cboUser.Value
Case "Commander"
[Commander] = vbYes
[Marked] = vbYes
Case "Iyer"
[Iyer] = vbYes
[Marked] = vbYes
Case "Finance"
[Finance] = vbYes
[Marked] = vbYes
Case "Suresh"
[Suresh] = vbYes
[Marked] = vbYes
Case "Jessie"
[Jessie] = vbYes
[Marked] = vbYes
Case "General"
[General] = vbYes
[Marked] = vbYes
End Select

Hope that helps!
On 13 Dec 2003 13:50:19 -0800, Prakash Wadhwani <si****@omantel.net.om>
wrote:
In a small Contacts Database, I have 6 Boolean(Yes/No) Fields so that
6 individuals in the company can maintain their own private mailing
list.

The names of the fields are as follows:
Commander
Iyer
Finance
Suresh
Jessie
General

I also have another Yes/No field called MARKED.

When the user selects one of the above 6 names in a combo box on my
form, I would like the MARKED field to get replaced with a YES for
each YES in the 6 Fields.

eg. if the user clicks COMMANDER, the MARKED field should get marked
with a YES for each YES in the COMMANDER field. Similarly with all the
other fields.

Can anyone please suggest how to go about doing this.

Thx & Best Rgds,
Prakash

Nov 12 '05 #3
NB
Prakash

As I understand it, you can use Update Query and run it from code to
do the update. To prevent the warning message from displaying you can
wrap the line of code that run the query (docmd.openquery or
db.execute)
with

docmd.setwarnings false
'run the updatequery here
docmd.setwarnings true

NB
Nov 12 '05 #4
ni******@lycos.com (NB) wrote:
As I understand it, you can use Update Query and run it from code to
do the update. To prevent the warning message from displaying you can
wrap the line of code that run the query (docmd.openquery or
db.execute)
with

docmd.setwarnings false
'run the updatequery here
docmd.setwarnings true


Actually with db.execute you don't need the setwarnings at all.

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror command instead of
docmd.runsql. For ADO use CurrentProject.Connection.Execute strCommand,
lngRecordsAffected, adCmdText

If you're going to use docmd.setwarnings make very sure you put the True statement in
any error handling code as well. Otherwise wierd things may happen later on
especially while you are working on the app. For example you will no longer get the
"Do you wish to save your changes" message if you close an object. This may mean
that unwanted changes, deletions or additions will be saved to your MDB.

Also performance can be significantly different between the two methods. One posting
stated currentdb.execute took two seconds while docmd.runsql took eight seconds. As
always YMMV.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #5
NB
> Actually with db.execute you don't need the setwarnings at all.

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror command instead of
docmd.runsql. For ADO use CurrentProject.Connection.Execute strCommand,
lngRecordsAffected, adCmdText
What about docmd.openquery ? I thought saved queries are faster than
running SQL from code?

If you're going to use docmd.setwarnings make very sure you put the True statement in
any error handling code as well. Otherwise wierd things may happen later on
especially while you are working on the app. For example you will no longer get the
"Do you wish to save your changes" message if you close an object. This may mean
that unwanted changes, deletions or additions will be saved to your MDB.

Does that happen even if you put docmd.setwarnings true back on
immediately after executing the query?

NB
Nov 12 '05 #6
ni******@lycos.com (NB) wrote:
Actually with db.execute you don't need the setwarnings at all.

I prefer, if DAO, to use Currentdb.Execute strSQL,dbfailonerror command instead of
docmd.runsql. For ADO use CurrentProject.Connection.Execute strCommand,
lngRecordsAffected, adCmdText


What about docmd.openquery ? I thought saved queries are faster than
running SQL from code?


You can still run saved queries using the Execute. Just put the query name in place
of strSQL.
If you're going to use docmd.setwarnings make very sure you put the True statement in
any error handling code as well. Otherwise wierd things may happen later on
especially while you are working on the app. For example you will no longer get the
"Do you wish to save your changes" message if you close an object. This may mean
that unwanted changes, deletions or additions will be saved to your MDB.

Does that happen even if you put docmd.setwarnings true back on
immediately after executing the query?


No. You need the setwarnings true immediately after the query and in the error
handling.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Nov 12 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

11
by: Jason | last post by:
Let's say I have an html form with 20 or 30 fields in it. The form submits the fields via POST to a php page which updates a table in a database with the $_POST vars. Which makes more sense? ...
1
by: Chris Jackson | last post by:
I'm a novice Access user and am not sure how to solve the following problem. Any help with the following would be greatly appreciated! I have two tables with identical structures, the first holds...
3
by: MLH | last post by:
I have a form, bound to a query. Its RecordSource property is a query named frmEnterLienAmounts. The form has a few bound controls and some unbound controls. The unbound controls are calculated...
4
by: Geoff | last post by:
Hi I'm hoping somebody can help me with the following problem that has occurred to me. Suppose I have two tables in an SQL Server database. Let's call these tables A and B. Assume that A has...
5
by: Hexman | last post by:
I've come up with an error which the solution eludes me. I get the error: >An unhandled exception of type 'System.Runtime.InteropServices.COMException' occurred in HRTest.exe > >Additional...
6
by: akoymakoy | last post by:
Run time error 3251 Current Recordset does not support updating, this may be a limitation of the provider, or of the selected Locktype This is my simple program that will split the entries that...
11
by: bbasberg | last post by:
Hello, I have been struggling with this problem for DAYS and have googled my heart out as well as reading any books I could get my hands on but I cannot find any specific references to my problem....
1
by: thandiwe | last post by:
may somebody help me, i am working on an access database and my tables have related fields. i want these fields to update at once after updating one of them..the fields have formulas, so i would...
2
by: =?Utf-8?B?VmFuZXNzYQ==?= | last post by:
Hi All! I am with a situation where I am not getting the right updating to the form's fields. The situation is the following one: I have one combobox and one textbox. I am using the...
0
by: Mike | last post by:
So here's the situation (.NET 2.0 btw): I have a form, and on this form is a textbox among many other databound controls. The textbox is bound to a field in a data table via the Text property. ...
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.