473,396 Members | 1,884 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,396 software developers and data experts.

Looping through records


Here is a chunk of code that works for an individual record. It
evaluates dates and checks or unchecks boxes as it goes along. It may
not be pretty but it works. What my problem is that I need it to
evaluate all the records(200+) in my db and change those which need
changing. Having to do it individually would defeat the purpose of
developing this code. What I would like to be able to do is either 1.
Open the db push a button and all the records update Or 2. Have it
update automatically each time the db opens. It really only needs to be
done once a day so I'm leaning towards #1. So I figure I need to be able
to loop this code through all the records until the last record then
stop. So heres the rub, How do I do that? Should this code be put in a
Module? My db opens up to a FORM called "TITLE PAGE" the records which
require updating are manipulated through a Second FORM called "MASTER
PAGE" I would like to be able to update the records at the TITLE PAGE.
It currently works with the push of a button on the MASTER PAGE but only
updates one record at at time, push the button it updates, manually
select new the record, push the button it updates, manually select new
the record... This is not how it should work. I would like it to work
from the TITLE PAGE Push the button updates all the records and I'm
done.

Private Sub test2_Click()

Dim db1 As Database
Dim rst As Recordset
Set db1 = DBEngine(0)(0)
Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)
Do While rst.BOF = False And rst.EOF = False
If (RFD) <= DATE Then
SAILING = True
End If

If (COURSE_OUT) <= DATE Then
COURSE = True
SAILING = False
End If
If (COURSE_IN) <= DATE Then
COURSE = False
SAILING = True
End If

If (COURSE) = True Then
LCA = False
SAILING = False
End If

If (LANDED_OUT) <= DATE Then
LCA = True
SAILING = False
End If
If (LANDED_IN) <= DATE Then
LCA = False
SAILING = True
End If

If (LCA) = False And _
COURSE = True Then
SAILING = False
End If

If (Start_Leave) <= DATE Then
CRS = True
SAILING = False
End If
If (Stop_Leave) <= DATE Then
CRS = False
SAILING = True
End If

If (START_DATE) <= DATE Then
MEDICAL = True
End If
If (STOP_DATE) <= DATE Then
MEDICAL = False
End If

If (COS_OUT_DATE) <= DATE Then
P_IN = False
ATP = False
SAILING = False
P_OUT = True
End If
rst.MoveNext
Loop

End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Nov 18 '05 #1
20 3019
you have to open the recordset that underlies the table you're looking
at... something along the lines of...

Sub UpdateMyRecords()
dim rs as dao.recordset
set rs=dbengine(0)(0).OpenRecordset("SELECT...FROM...W HERE...",
dbOpenDynamic)
do until rs.EOF
rs.Edit '---allow editing
'---drop your record-by-record processing code here
'---do your edits here
rs.Update '---save the changes
rs.MoveNext
loop
rs.Close
Set rs=nothing
End Sub

Nov 19 '05 #2
Ok, If I understood your reply below is what I've got. This is based on
my limited understanding of all things VB.
Along with the Forms I mentioned in my first post the tables I am
atempting to edit are enclosed in the quotes below. please confirm that
where you mentioned rs it has the same meaning as rst. I expect that I
have not understood your reply because when I run the code the way it's
set up below I get nothing, not even an error message, and I've seen my
share of them. I sense that the solution is close. Thank you for your
time.

Private Sub test2_Click()
Dim rs As dao.Recordset
Set rs = DBEngine(0)(0).OpenRecordset("Pers_Landed", dbOpenDynamic)
Set rs = DBEngine(0)(0).OpenRecordset("Pers_Posting", dbOpenDynamic)
Set rs = DBEngine(0)(0).OpenRecordset("Pers_Medical", dbOpenDynamic)
Set rs = DBEngine(0)(0).OpenRecordset("Pers_Other_Data", dbOpenDynamic)
Do Until rst.EOF
rs.Edit

If (RFD) <= DATE Then
SAILING = True
End If

If (COURSE_OUT) <= DATE Then
COURSE = True
SAILING = False
End If
If (COURSE_IN) <= DATE Then
COURSE = False
SAILING = True
End If

If (COURSE) = True Then
LCA = False
SAILING = False
End If

If (LANDED_OUT) <= DATE Then
LCA = True
SAILING = False
End If
If (LANDED_IN) <= DATE Then
LCA = False
SAILING = True
End If

If (LCA) = False And _
COURSE = True Then
SAILING = False
End If

If (Start_Leave) <= DATE Then
CRS = True
SAILING = False
End If
If (Stop_Leave) <= DATE Then
CRS = False
SAILING = True
End If

If (START_DATE) <= DATE Then
MEDICAL = True
End If
If (STOP_DATE) <= DATE Then
MEDICAL = False
End If

If (COS_OUT_DATE) <= DATE Then
P_IN = False
ATP = False
SAILING = False
P_OUT = True
End If
rs.Update
rs.MoveNext
Loop
rs.Close
Set rs = Nothing
End Sub


*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #3
Hmm... one thing that's definitely wrong... what are START_DATE etc?
If they're fields in your recordset, you have to use a syntax like
this:

If rs.Fields("Start Date")<=Date() Then
....'set your field values here.
End If

If these are simple If statements, then why not just use a series of
update queries? that's a LOT faster than looping through a bunch of
updates. Can you not create a series of update queries with WHERE
Statements?

eg. -say this is a query called "qupdCOS_OUT_DATE"
UPDATE MyTable
SET P_IN=False,
ATP=False
SAILING=False
P_Out=True
WHERE COS_OUT_DATE <=Date;

Then you could just do something like:
DoCmd.SetWarnings False
DoCmd.OpenQuery "qupdCOS_OUT_DATE"
DoCmd.OpenQuery "Another update Query"
.....
DoCmd.SetWarnings=True

Walking recordsets is something you don't want to do unless you really
have to. It will get REALLY slow when you have a lot of records,
especially compared to an update query.

Nov 19 '05 #4
Good morning, Well I tried your sugestion about the queries. I think I
have it set up the way you described but when I run it the error I get
is when it gets to the word "Update" The error is "Compile error Sub or
Function Not Defined".
Same topic different approach. I have already made a whole series of
UPDATE queries useing the querie builder in MS Access. they are grouped
together and run through a Macro. They do exactly what I am trying to
achive using VB with the exception that each time a querie runs I get
two message boxes, one telling me that the querie is about to change
data and then the second asking if I want to procede. As you can tell
from the VB script that I wrote there are alot of Update queries to run
therefore it is is quite annoying, and I think not polished looking, to
have to sit there and bang through the dialog boxes answering yes each
time. Now if I can get a way to run those queries and not get the
message boxes things would be golden. Any ideas on that?

Private Sub qupdCOS_OUT_DATE_Click()
Update Pers_Posting
Set P_IN = False
ATP = False
SAILING = False
P_OUT = True
Where Cos_Out_Date <= DATE

'Then you could just do something like:
DoCmd.SetWarnings False
DoCmd.OpenQuery "qupdCOS_OUT_DATE"
'DoCmd.OpenQuery "Another update Query"

DoCmd.SetWarnings = True

End Sub

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #5
Put this at the beginning of your Macro:
SetWarnings False
Put this at the end of your Macro:
SetWarnings True

BE SURE TO SET WARNINGS BACK TO TRUE!!!!
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdatasheet.com
www.pcdatasheet.com

If you can't get the help you need in the newsgroup, I can help you for a
very reasonable fee. Over 1000 Access users have come to me for help.
Need a month calendar or 7 day calendar? Need appointment scheduling? Need
room reservations scheduling? Need employee work scheduling? Contact me!
"Stewart Graefner" <sg*******@eastlink.ca> wrote in message
news:cU**************@news.uswest.net...
Good morning, Well I tried your sugestion about the queries. I think I
have it set up the way you described but when I run it the error I get
is when it gets to the word "Update" The error is "Compile error Sub or
Function Not Defined".
Same topic different approach. I have already made a whole series of
UPDATE queries useing the querie builder in MS Access. they are grouped
together and run through a Macro. They do exactly what I am trying to
achive using VB with the exception that each time a querie runs I get
two message boxes, one telling me that the querie is about to change
data and then the second asking if I want to procede. As you can tell
from the VB script that I wrote there are alot of Update queries to run
therefore it is is quite annoying, and I think not polished looking, to
have to sit there and bang through the dialog boxes answering yes each
time. Now if I can get a way to run those queries and not get the
message boxes things would be golden. Any ideas on that?

Private Sub qupdCOS_OUT_DATE_Click()
Update Pers_Posting
Set P_IN = False
ATP = False
SAILING = False
P_OUT = True
Where Cos_Out_Date <= DATE

'Then you could just do something like:
DoCmd.SetWarnings False
DoCmd.OpenQuery "qupdCOS_OUT_DATE"
'DoCmd.OpenQuery "Another update Query"

DoCmd.SetWarnings = True

End Sub

*** Sent via Developersdex http://www.developersdex.com ***

Nov 19 '05 #6

"PC Datasheet" <no****@nospam.spam> schreef in bericht news:zW*****************@newsread1.news.atl.earthl ink.net...

To Steve:
WE *WILL* BE SURE TO SET WARNINGS FOR NEW USERS TO TRUE!!!!

<snipped all the advertising stuff>

To the OP: Beware of this guy!!

Steve just does *not* care about the newsgroups. He has *no ethics at all*.
Steve *only* cares about making *money*, and he acts as if the groups are his private hunting ground.

-- He abuses this group and others for job-hunting and advertising over and over again
-- He is insulting lots of people here when they ask him to stop this
-- He posted as Steve, Ron, Tom, Rachel, Kathy, Kristine, Heather and ??? while asking questions
(the latest 'star's': 'Access Resource' and Tom no***@email.com and Andy)
-- He tries to sell a CD ($125,--) with FREE code he gathered from these groups here
-- There even has been a 'Scam-alert' about him which has been explained recently in the thread 'To all':
http://groups.google.com/group/comp....954261f9?hl=en
-- Also recently it became clear that he has been spamming innocent people asking questions:
http://groups.google.com/group/comp....3e5f58ad?hl=en

So why would ANYBODY ever trust a person like him and hire him?
************************************************** ******

Explanation and more links on this answer:
http://home.tiscali.nl/arracom/stopsteve.html

Arno R
Nov 19 '05 #7
Setting the warnings To False and Back to True worked. This Thread is
Finished. Thanks very much to all who assisted.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 19 '05 #8
Stewart Graefner <sg*******@eastlink.ca> wrote in
news:fo***************@news.uswest.net:
Setting the warnings To False and Back to True worked. This
Thread is Finished. Thanks very much to all who assisted.


Your code is completely nonsensical. I can't imagine that it would
work, unless all the fields you're operating on are in the last
recordset. That is:

Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

is going to be completely equivalent to:

Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

Everything before that is gone when you execute that line.

Secondly, there's nothing in your code that tells us what RFD,
SAILING, COURSE_OUT and so forth are. Are they fields in the form?

No one could possibly have answered your question becuase the code
makes no sense at all as posted.

But I'm glad you solved your problem on your own -- your post was
certainly completely unlikely to generate any useful help.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 20 '05 #9
David Fenton. Thanks for taking the time to reply to my post. I posted
my questions here in order to get assistance. If I knew what I was doing
I wouldn't be here. You are obviously some one who seems to know alot
about VB Programing. If you've taken the time to responed why couldn't
you be nicer about it and ask questions in a polite maner rather than
berating me and providing me with no assistance what so ever. I would
have very much enjoyed learning from you. In a classroom there are
teachers who write on the board, students who read from the board and
goofballs that sit in the back throwing spitballs. Which one are you
David?
P.S. yes they are all fields on a form. The "Ifs" are Date Fields and
the "Thens" are check boxes. All you had to do was ask.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 20 '05 #10
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn**********************************@216.196. 97.142...

Your code is completely nonsensical. I can't imagine that it would
work, unless all the fields you're operating on are in the last
recordset. That is:

Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

is going to be completely equivalent to:

Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

Everything before that is gone when you execute that line.

David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc

The repetition of the "Set rst =" may look ridiculous, but it indicates
someone who runs the code directly from the VBA window. The user/developer
may want to run the code against several different tables and does not want
to take the time to create a user interface to select the table name from.
So rather than remembering each table and retying it in each time. the U/D
creates a statement for each knowing that the last guy wins. So when it is
time to use a different table, it is just a matter of cutting and pasting to
the end of the list. The list also makes sure no tables are missed.

John... Visio MVP
Nov 20 '05 #11
"John Marshall, MVP" <la******@stonehenge.ca> wrote in
news:K9******************************@magma.ca:
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn**********************************@216.196. 97.142...

Your code is completely nonsensical. I can't imagine that it
would work, unless all the fields you're operating on are in the
last recordset. That is:

Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

is going to be completely equivalent to:

Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

Everything before that is gone when you execute that line.

The repetition of the "Set rst =" may look ridiculous, but it
indicates someone who runs the code directly from the VBA window.
The user/developer may want to run the code against several
different tables and does not want to take the time to create a
user interface to select the table name from. So rather than
remembering each table and retying it in each time. the U/D
creates a statement for each knowing that the last guy wins. So
when it is time to use a different table, it is just a matter of
cutting and pasting to the end of the list. The list also makes
sure no tables are missed.


Well, perhaps.

But I've never in all my years of Access and readig this newsgroup
seen anyone post anything like that, so it's pretty uncommon and
deserving of an explanation.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 20 '05 #12
Ok I'll bite. Iwas just going to let this whole thing die but I never
pass an opertuneite to learn something. Looking back at my post's I will
admit to being abit vague. But all ya had to do was ask. The "Chunk of
Code" to which I was refering was.... The items in the brackes are Date
Fields on what I've called the Master Form. The other items are check
boxes.
IF (Date)<=Date then
check box = True or False

If (RFD) <= DATE Then
SAILING = True
End If

If (COURSE_OUT) <= DATE Then
COURSE = True
SAILING = False
End If
If (COURSE_IN) <= DATE Then
COURSE = False
SAILING = True
End If

If (COURSE) = True Then
LCA = False
SAILING = False
End If

If (LANDED_OUT) <= DATE Then
LCA = True
SAILING = False
End If
If (LANDED_IN) <= DATE Then
LCA = False
SAILING = True
End If

If (LCA) = False And _
COURSE = True Then
SAILING = False
End If

If (Start_Leave) <= DATE Then
CRS = True
SAILING = False
End If
If (Stop_Leave) <= DATE Then
CRS = False
SAILING = True
End If

If (START_DATE) <= DATE Then
MEDICAL = True
End If
If (STOP_DATE) <= DATE Then
MEDICAL = False
End If

If (COS_OUT_DATE) <= DATE Then
P_IN = False
ATP = False
SAILING = False
P_OUT = True
End If

End Sub

It may not be pretty but it worked sort of. It did update the current
record but I wanted something that would update all the records in my
db, about 250, My db tracks the comings and going of people on a daily
basis. It would be completely inefficent to have to go through all the
records which require updating. Not all of the 250 people are coming and
going on any given day. I made a Macro using Update queries and it did
do what I wanted but each time a querie rau I got two Message boxes to
answer yes to, again inefficent. If I had of know about the set warnings
in the Macros I could have stoped right there but i didnt so I started
looking at ways to do it with VB.
The following code was an attempt at making the above code update all
the records. The stuff in the quotes are the tables which are updated
from the form.

Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

Yeah its ugly and it didn't work but thats why it's here. I was hoping
that sombody would pick it up and give me a hand not tear me a new arse.
I make no apoliges for my poor code writing, I'm a rookie and the was
really my first attempt at writing code. Thanks for making the
experiance so memorable David.
All anybody had to do was ask. So there it is the story in a nut shell.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 20 '05 #13

Before I get another post from sombody I already know my
spelling sucks.

*** Sent via Developersdex http://www.developersdex.com ***
Nov 20 '05 #14
"Stewart Graefner" wrote
IF (Date)<=Date then
check box = True or False


It appears you have either a Field or a Control named "Date". "Date" is an
Access reserved word and should not be used to name an object because it can
lead to confusion.

Larry Linson
Microsoft Access MVP
Nov 21 '05 #15
That was just an example
IF (Date)<=Date then
check box = True or False


In the piece below
The "Date" is actually in the field called (START_DATE)
In this case the "Check box" is is a True/False box called MEDICAL. And
so on. Everything in brackets are in Fields on a Form I've called
"Master Form" and formated for
Med Date() dd mm yy. All the True/False statements are Check boxes.

If (START_DATE) <= DATE Then
MEDICAL = True
End If
If (STOP_DATE) <= DATE Then
MEDICAL = False
End If

It's all stored in the Tables in my previous post

*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #16
rkc
Stewart Graefner wrote:
Ok I'll bite. Iwas just going to let this whole thing die but I never
pass an opertuneite to learn something. Looking back at my post's I will
admit to being abit vague. But all ya had to do was ask. The "Chunk of
Code" to which I was refering was.... The items in the brackes are Date
Fields on what I've called the Master Form. The other items are check
boxes.
IF (Date)<=Date then
check box = True or False

If (RFD) <= DATE Then
SAILING = True
End If

If (COURSE_OUT) <= DATE Then
COURSE = True
SAILING = False
End If
If (COURSE_IN) <= DATE Then
COURSE = False
SAILING = True
End If

If (COURSE) = True Then
LCA = False
SAILING = False
End If

If (LANDED_OUT) <= DATE Then
LCA = True
SAILING = False
End If
If (LANDED_IN) <= DATE Then
LCA = False
SAILING = True
End If

If (LCA) = False And _
COURSE = True Then
SAILING = False
End If

If (Start_Leave) <= DATE Then
CRS = True
SAILING = False
End If
If (Stop_Leave) <= DATE Then
CRS = False
SAILING = True
End If

If (START_DATE) <= DATE Then
MEDICAL = True
End If
If (STOP_DATE) <= DATE Then
MEDICAL = False
End If

If (COS_OUT_DATE) <= DATE Then
P_IN = False
ATP = False
SAILING = False
P_OUT = True
End If

End Sub

It may not be pretty but it worked sort of. It did update the current
record but I wanted something that would update all the records in my
db, about 250, My db tracks the comings and going of people on a daily
basis. It would be completely inefficent to have to go through all the
records which require updating. Not all of the 250 people are coming and
going on any given day. I made a Macro using Update queries and it did
do what I wanted but each time a querie rau I got two Message boxes to
answer yes to, again inefficent. If I had of know about the set warnings
in the Macros I could have stoped right there but i didnt so I started
looking at ways to do it with VB.
The following code was an attempt at making the above code update all
the records. The stuff in the quotes are the tables which are updated
from the form.

Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)

Yeah its ugly and it didn't work but thats why it's here. I was hoping
that sombody would pick it up and give me a hand not tear me a new arse.
I make no apoliges for my poor code writing, I'm a rookie and the was
really my first attempt at writing code. Thanks for making the
experiance so memorable David.
All anybody had to do was ask. So there it is the story in a nut shell.

The main point dw fenton was trying to make (in his usual gruff manner)
was that opening four different recordsets, one after the other, using
the same recordset variable leaves you with a recordset with data from
the last time it was opened only. That being the case it is doubtful
(impossible, actually) that any result that needed data from the other
three times it was opened could be correct.

It appears to me that what you are doing is updating the same 250
or so records over and over again and that the fields that you are
trying to fill in via code contain information that could be calculated
at the time someone wanted to view it. What that usually indicates
is a data structure that is not really up to the task at hand.

Unless you want to take the time to go into more detail about the
structure, and purpose of your database you probably have already
received any help that can reasonably be offered.



Nov 21 '05 #17
"David W. Fenton" <dX********@bway.net.invalid> wrote in message
news:Xn**********************************@216.196. 97.142...

But I've never in all my years of Access and readig this newsgroup
seen anyone post anything like that, so it's pretty uncommon and
deserving of an explanation.

David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc


I will not say whether it was/is good or bad coding practise, just that it
is convenient.

The first time I saw that "technique" was back in the days of punched cards.
It was not uncommon to have a series of duplicated variable initialization
statements. So rather than wait for a key punch terminal, it was just a
matter of shuffling the cards. By running a marker along the edge of these
cards, it was very easy to find these cards.

John...
Nov 21 '05 #18
Should I have idenitfied each rst
From this
Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)
To this Set rst = db1.OpenRecordset("Pers_Landed", dbOpenTable)
Set rst1 = db1.OpenRecordset("Pers_Posting", dbOpenTable)
Set rst2 = db1.OpenRecordset("Pers_Medical", dbOpenTable)
Set rst3 = db1.OpenRecordset("Pers_Other_Data", dbOpenTable)
How do I identify which Field is from which Table? Or do I have
to?See#2. If this routine was launched from another Form other than the
one on which the Fields are used do I have to identify the Form on which
they are used?See#3.
For example to use just one of the many IF routines.

From This If (LANDED_OUT) <= DATE Then
LCA = True
SAILING = False
End If
If (LANDED_IN) <= DATE Then
LCA = False
SAILING = True
End If
To this
#2 If .Fields!(LANDED_OUT) <= DATE Then
LCA = True
SAILING = False
End If
If .Fields!(LANDED_IN) <= DATE Then
LCA = False
SAILING = True
End If
#3 If Master_Form!(LANDED_OUT) <= DATE Then
LCA = True
SAILING = False
End If
If Master_Form!(LANDED_IN) <= DATE Then
LCA = False
SAILING = True
End If


I thought that having the Data, eg (Landed_Out), in brackets implied
Fields.

Any ideas on how this all fits together? And what do I put in between
the last End If and End Sub To make the routine loop through all the
records when called?

Ahhhh Questions...


*** Sent via Developersdex http://www.developersdex.com ***
Nov 21 '05 #19
Stewart Graefner <sg*******@eastlink.ca> wrote in
news:zz**************@news.uswest.net:
Ok I'll bite. Iwas just going to let this whole thing die but I
never pass an opertuneite to learn something. Looking back at my
post's I will admit to being abit vague. But all ya had to do was
ask. The "Chunk of Code" to which I was refering was.... The items
in the brackes are Date Fields on what I've called the Master
Form. The other items are check boxes.
IF (Date)<=Date then
check box = True or False

If (RFD) <= DATE Then
SAILING = True
End If


Well, this is such nonstandard code that I didn't know what I was
seeing. I would never write anything but:

If (Me!RFD) <= DATE Then
Me!SAILING = True
End If

Had you simply explained a bit more of what your code was doing, or
simplified it to the basics, it would have made it a lot easier to
zero in on your question. I generally don't have time to puzzle
through large complex blocks of code to figure out what is being
attempted, unless there are explanations and comments to guide me.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 23 '05 #20
"Larry Linson" <bo*****@localhost.not> wrote in
news:zw8gf.3028$Vu2.1247@trnddc06:
"Stewart Graefner" wrote
IF (Date)<=Date then
check box = True or False


It appears you have either a Field or a Control named "Date".
"Date" is an Access reserved word and should not be used to name
an object because it can lead to confusion.


I was going to say the same thing, but then realized this was just
an explanation of the abstract format of each of the If/Then/Else
blocks.

It was confusing, indeed, and basically makes my point about the
whole post.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 23 '05 #21

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

Similar topics

0
by: Comcast News | last post by:
Hi , We are facing a java issue. We are looping thru a resultset which has about 40 K records. The process terminates abnormally after about 20-25K records. The Query fetches has 400 columns. We...
4
by: Roy Adams | last post by:
Hi posting again because no answer to previous.. tring to loop through a recordset and update a record, thing is it only updates the first record in the table rather than searching through the...
6
by: Michael Goerz | last post by:
Hi, I'm trying to write a loop that cycles through all the records. This I use for doing comparisons between all records or to export all records to a text file. I'm using the following code: ...
8
by: RC | last post by:
I have a table that lists many box numbers. Each box number has a Pallet Number (indicating which pallet the box is in). When the Pallets are loaded into a shipping Container I need to update the...
7
by: Ken | last post by:
Hi All - I have a filtered GridView. This GridView has a check box in the first column. This check box is used to identify specific rows for delete operations. On the button click event I...
1
by: lucazz | last post by:
I have a main form (not bound to any data source) with a subform based on a query. The subform shows furniture parts according to the criteria specified on the main form. The purpose of the subform...
1
by: Ryan | last post by:
Hello. I was hoping that someone may be able to assist with an issue that I am experiencing. I have created an Access DB which imports an Excel File with a particular layout and field naming. ...
3
by: DWolff | last post by:
My application is to re-assign leads to different groups of salespeople by sequentially assigning them to each salesperson. I've got an Access 2000 front end to an MS-SQL database. Currently, I...
3
by: David | last post by:
Hi, I have an asp page which lists records out in rows Each record has a checkbox with a value parameter equal to the RecordID When the form is run, it goes to a page which I am trying to...
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
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
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.