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 ***