lacampeona
Registered User.
- Local time
- Today, 17:08
- Joined
- Dec 28, 2015
- Messages
- 392
Hello experts, I need some help with extracting some value from a table. I was thinking to use Dlookup function in my form procedure.
But then I get stuck.
I have tableA who stores general data about items.
Then I have tableB who stores data about usage for that items.
The table A is mother and tableB are the children. They are connected with ItemID-primary key.
This mean tblA have
ItemID
1
2
3
tbl B have:
UsageID ItemID status
1 1
2 1 entered
3 2 approved
4 1 aprroved
5 3 entered
I need to check if some field contains specific value.
If the status field in tblB is "empty"( UsageID 1) I need to tell to the user he can not use this item becouse is not approved.
if the status field in tblB "entered "(UsageID 2,5) I need to tell to the user he can not use this item becouse is not approved.
if the status field is tblB "approved" (UsageID 3, 4) then user can use specific item.
From this case user can only use item 3 and 4, but I get stuck...
My problem is that what I make now...acess check entire table and when he finds the first item who is empty or entered he tell to the user he can not use that item.
Becouse User want to use item 3 who is approved and he can not used it becouse item 1 is empty and item 2 is entered.
How to create that correctly? that dloolukup can search the values only in the children table with specific Usage ID and not to entire table?
What I have for now is not what I want: I want to use item 3 and I cant becouse usageID1 and UsageID 2 are not in approved status.
I have this in my form event on click on- combo box named NamenUporabe.
Case Me.StanjeSproscanja & "" = "(3) Sproscena" And Me.NamenUporabe = "RednaAnaliza"
If DLookup("[UporabaKID]", "tblUporabaKolon", "IsNull([status]) and [SproscanjeUstrezno]='DA'") Then
MsgBox "You can not use that item.Status is not approved."
DoCmd.Close acForm, "frmKoloneUporabaSUB"
ElseIf DLookup("[UporabaKID]", "tblUporabaKolon", "[status] = 'entered' and [SproscanjeUstrezno]='DA'") Then
MsgBox "You can not use that item.Status is not approved."
DoCmd.Close acForm, "frmKoloneUporabaSUB"
End If
End Select
End Sub
What I can do? thank you very much.
But then I get stuck.
I have tableA who stores general data about items.
Then I have tableB who stores data about usage for that items.
The table A is mother and tableB are the children. They are connected with ItemID-primary key.
This mean tblA have
ItemID
1
2
3
tbl B have:
UsageID ItemID status
1 1
2 1 entered
3 2 approved
4 1 aprroved
5 3 entered
I need to check if some field contains specific value.
If the status field in tblB is "empty"( UsageID 1) I need to tell to the user he can not use this item becouse is not approved.
if the status field in tblB "entered "(UsageID 2,5) I need to tell to the user he can not use this item becouse is not approved.
if the status field is tblB "approved" (UsageID 3, 4) then user can use specific item.
From this case user can only use item 3 and 4, but I get stuck...
My problem is that what I make now...acess check entire table and when he finds the first item who is empty or entered he tell to the user he can not use that item.
Becouse User want to use item 3 who is approved and he can not used it becouse item 1 is empty and item 2 is entered.
How to create that correctly? that dloolukup can search the values only in the children table with specific Usage ID and not to entire table?
What I have for now is not what I want: I want to use item 3 and I cant becouse usageID1 and UsageID 2 are not in approved status.
I have this in my form event on click on- combo box named NamenUporabe.
Case Me.StanjeSproscanja & "" = "(3) Sproscena" And Me.NamenUporabe = "RednaAnaliza"
If DLookup("[UporabaKID]", "tblUporabaKolon", "IsNull([status]) and [SproscanjeUstrezno]='DA'") Then
MsgBox "You can not use that item.Status is not approved."
DoCmd.Close acForm, "frmKoloneUporabaSUB"
ElseIf DLookup("[UporabaKID]", "tblUporabaKolon", "[status] = 'entered' and [SproscanjeUstrezno]='DA'") Then
MsgBox "You can not use that item.Status is not approved."
DoCmd.Close acForm, "frmKoloneUporabaSUB"
End If
End Select
End Sub
What I can do? thank you very much.