Hey Fred,
Sorry, but your explanation is about as clear as mud to me. I understand
that my data is actually in the table and getting it from the forms was just
a reference. I can poll the table for the info except that it has to
reference the record number that I am currently in. That is where I am
presently falling on my face. I cannot at this time base the forms on
queries as I am working on final touches to about 4 months work. Please help
me to better understand your code example.
fredg said:
On Tue, 15 Mar 2005 12:13:03 -0800, Bryan wrote:
8 separate forms, though not open at the same time. The forms are custom
designed for each function with only the data they need. Thanks!
:
On Tue, 15 Mar 2005 09:19:08 -0800, Bryan wrote:
I have 2 questions here. (1) Is there any way to keep a yes in a yes/no
checkbox from being unchecked? Once it has been checked, (I have an After
Update event that autofills current user "signature" and date,) I don't want
them to be able to "uncheck it." (2) I need to qualify the yes in the first
place. I have 8 forms filled out by a different function. They need to be
completed in order. So, I don't want the P & L Manager to "sign" his form
until procurement has "signed" theirs, and so on. I haven't been able to
pull together the code in the Before Update to make either of these happen.
Any ideas?
In the form's current event:
If CheckBox = True Then
[Signature] = "XXX"
[DateControl] = Date()
[CheckBox].Enabled = False
[CheckBox].Locked = True
Else
[CheckBox].Enabled = True
[CheckBox].Locked = False
End If
In the Check box control's AfterUpdate event:
If CheckBox = True Then
[SomeOtherControl].SetFocus
Check.Enabled = False
Check.Locked = True
End If
As for your having 8 forms to fill out first, that is not quite a
clear statement. Do you actually have 8 different 'Forms' all open at
the same time, or did you mean 8 different controls on this form to be
filled in first?
Since forms don't actually contain data, (tables do), it's hard to
know what you mean.
--
Fred
Please only reply to this newsgroup.
I do not reply to personal email.
If the form's were open, you can refer to a control on the form using
forms!FormName!ControlName.
What happens to the data entered in those forms? Saved in a table?
Now you can refer to the table to determine if the correct data is
there:
If DLookUp("[FieldName]","TableName","[SomeField] = '" & SomeCriteria
& "'") = Something Then
Else
End If
A better solution would be to use a query as this form's recordsource
and include that other table in the query. Be aware that some
multi-table queries are not updateable.
In any event, a closed form has no data, and therefore cannot be
referred to.
OK,
Let's say you are working on FormC and the ID of the project is stored
in [RecordID], which is the same unique record number for that project
in all of the tables involved. Let's also say that [RecordID] is a
number datatype:
Dim strTest as String
strTest = DLookUp("[FieldName]","TableName","[RecordID] = " &
Me![RecordID])
If strTest = "SomeCriteria" then
' Do some stuff here
Else
' Do some other stuff here
End If
If [RecordID] is a Text datatype field, then use:
"[RecordID] = '" & Me![RecordID] & "'")
Repeat something similar for each of the criteria needed.
This is just an outline.
See VBA help on DLookUp as well as
Where Clause + Restrict Data to a subset of records