# Solvedthe expression you entered is too complex (1 Viewer)

Your language says it all You have created a spreadsheet rather than a normalized relational database. Relational databases do not have "cells". Each "cell" in a spreadsheet is an independent entity and that is why you have all those domain functions, each of which is running a separate query.
by cells i meant textbox with dcount in it sorry

You do not say what the error is?

I would be using Me.txtb if that is a control on the form.
i used

Code:
``````Private Sub Form_Current()
Select Case [RiskCode]
Case 1: Me.txtb = "1A"
Case 2: Me.txtb = "1B"
Case 3: Me.txtb = "1C"
Case 4: Me.txtb = "2A"
Case 5: Me.txtb = "2B"
Case 6: Me.txtb = "2C"
Case 7: Me.txtb = "3A"
Case 8: Me.txtb = "1D"
Case 9: Me.txtb = "1E"
Case 10: Me.txtb = "2D"
Case 11: Me.txtb = "3B"
Case 12: Me.txtb = "3C"
Case 13: Me.txtb = "4A"
Case 14: Me.txtb = "2E"
Case 15: Me.txtb = "3D"
Case 16: Me.txtb = "4B"
Case 17: Me.txtb = "4C"
Case 18: Me.txtb = "5A"
Case 19: Me.txtb = "5B"
Case 20: Me.txtb = "3E"
Case 21: Me.txtb = "4D"
Case 22: Me.txtb = "4E"
Case 23: Me.txtb = "5C"
Case 24: Me.txtb = "5D"
Case 25: Me.txtb = "5E"
Case Else me.txtb = "recheck"

End Select

End Sub``````

and got this

and it highlighs Private Sub Form_Current()
with yellow color with an arrow

No, you were technically correct. They are all unbound and unrelated and each is populated by a separate query. In some situations that is necessary but not all. Your grid, for example, could be done with a subform if the underlying data is normalized.

i used

Code:
``````Private Sub Form_Current()
Select Case [RiskCode]
Case 1: Me.txtb = "1A"
Case 2: Me.txtb = "1B"
Case 3: Me.txtb = "1C"
Case 4: Me.txtb = "2A"
Case 5: Me.txtb = "2B"
Case 6: Me.txtb = "2C"
Case 7: Me.txtb = "3A"
Case 8: Me.txtb = "1D"
Case 9: Me.txtb = "1E"
Case 10: Me.txtb = "2D"
Case 11: Me.txtb = "3B"
Case 12: Me.txtb = "3C"
Case 13: Me.txtb = "4A"
Case 14: Me.txtb = "2E"
Case 15: Me.txtb = "3D"
Case 16: Me.txtb = "4B"
Case 17: Me.txtb = "4C"
Case 18: Me.txtb = "5A"
Case 19: Me.txtb = "5B"
Case 20: Me.txtb = "3E"
Case 21: Me.txtb = "4D"
Case 22: Me.txtb = "4E"
Case 23: Me.txtb = "5C"
Case 24: Me.txtb = "5D"
Case 25: Me.txtb = "5E"
Case Else me.txtb = "recheck"

End Select

End Sub``````

and got this
View attachment 113650

and it highlighs Private Sub Form_Current()
with yellow color with an arrow

View attachment 113651
Look at the sub above the current event.

This would have worked:
Case Else: s = "recheck"

But MUCH better would be to look up these codes in a new table. Then it's a one-liner:
Me.txtb = Nz(DLookup(...), "recheck")

Why not
Case Else : me.txtb="recheck"

The Case Else is the only case statement that has code after it on the same line but not delimited by ":" - so I think it is kvetching about the Case Else statement. Besides - that red highlight - if it came from Access rather than from your personal highlighting - says THAT line is in error.

Code:
``    Case Else txtb = "recheck"``

I believe you either need a colon after Else or to put the actual assignment on a new line after Else

Of course what you really need is some sort of saved data structure that stores records of associated data together. If only the developers of Access had thought to include such a malleable structure.

Why not
Case Else : me.txtb="recheck"
now it works, but active record's data populated to others.

Code:
``    Case Else txtb = "recheck"``

I believe you either need a colon after Else or to put the actual assignment on a new line after Else

Of course what you really need is some sort of saved data structure that stores records of associated data together. If only the developers of Access had thought to include such a malleable structure.
i added a new table with 25 IDs with primary keys and link this table with my MainTable.

so now how do u make riskSLcode to be shown in my countiniusly form. i think it should be somehting with =riskID = " & risk

so now how do u make riskSLcode to be shown in my countiniusly form.
Change the form's RecordSource to:
SQL:
``````SELECT m.*, c.riskSLcode
FROM TMain m
INNER JOIN FriskSL c
ON m.RiskCode = c.riskSLid``````

Then set the ControlSource of your textbox to [riskSLcode]

Change the form's RecordSource to:
i have already data in sql, as it needs to display data in continius form.

how can i combine them ? i mean how can i make them work together ?

i renamed FriskSLcode to TriskSLcode as its a table not a form. sorry,

FriskSL also needs a sovereignty field

YEAH ! i made it !
u guys helped me a lot. it was so easy actually

i just made this textbox countro sorce that field in table i created where 25 autonumbers ID (with PK) = sov \ likehood indicator

then i just added in my countiniusl form

in SQL i saw a new code
Code:
``FROM TriskSL INNER JOIN Tmain ON TriskSL.riskSLid = Tmain.RiskCode;``

and now it works !!!!!

look

But MUCH better would be to look up these codes in a new table. Then it's a one-liner:
Me.txtb = Nz(DLookup(...), "recheck")
Even better than 25 queries is a left join in the RecordSource query

Replies
12
Views
2,929
Replies
5
Views
6,573
Replies
3
Views
2,823
Replies
2
Views
914
Replies
3
Views
5,347