Haider Majeed
New member
- Local time
- Today, 09:02
- Joined
- Oct 13, 2019
- Messages
- 7
Hi. Welcome to AWF! If that's an image of your table structure, then you may have a non normalized design. If so, you might consider normalizing your table structure first, if it's not too late.
The picture shows a table which does not look normalised. Your first step would be to normalise your db as already recommended by theDBguy.is this valuable?
update marks set Fail_Topics = fnkFailed([s_name])
public function fnkFailed(s_name as variant) As string
dim s_return as string
If Trim(s_name & "")="" then exit function
with currentdb.openrecordset("select * from marks where st_name = '" & s_name & "'")
if not (.bof and .eof) then
.movefirst
if nz(!topic1, 0) < 50 then _
s_return = s_return & "Topic1, "
if nz(!topic2, 0) < 50 then _
s_return = s_return & "Topic2, "
if nz(!topic3, 0) < 50 then _
s_return = s_return & "Topic3, "
if s_return <> "" then s_return = left(s_return, len(s_return)-2)
end if
end with
fnkFailed = s_return
The picture shows a table which does not look normalised. Your first step would be to normalise your db as already recommended by theDBguy.
If you do not understand what normalising a db is about, have a quick search of this forum or google.
is this valuable?
Hi. Unfortunately, that's exactly what we meant by a non-normalized table structure. If it's not too late, you should make an attempt to normalize it. If you did, then your table might look something more like this instead:I apologize dear and This is the structure of tables
Yes, you can. We're not saying you can't. However, I also mentioned earlier you might not need a loop even with the current table structure by using an IIf() statement. What we're trying to tell you is if you're going to use a database, then we would like to encourage you to use it properly. That's all. No one is forcing you to do anything you don't want to or can't do. Maybe it's out of your hands. If so, you might ask if they (whoever is in control) can make the changes for you.Thank a lot for your efforts. You mean I can not loop through these recordset to find topics with less than 50 and to insert them in a new field in the way I mentioned?
Hi. Here's what I mean by using an IIf() statement instead of a loop. Open up Query1.Yes, you can. We're not saying you can't. However, I also mentioned earlier you might not need a loop even with the current table structure by using an IIf() statement. What we're trying to tell you is if you're going to use a database, then we would like to encourage you to use it properly. That's all. No one is forcing you to do anything you don't want to or can't do. Maybe it's out of your hands. If so, you might ask if they (whoever is in control) can make the changes for you.
Thanks a lot I got benefit from the application of the query
Regards