open forms based on if record exists (1 Viewer)

Locopete99

Registered User.
Local time
Today, 11:33
Joined
Jul 11, 2016
Messages
163
Hi,

Can you help.

I'm trying to open one of two forms based on if a record exists in a table.

Can someone look at the code below and see where its gone wrong. the code doesn't do anything.

Code:
If DCount("Holon", "tbl_Holonsecurity", "[User]=" & fOSUserName()) > 0 Then

DoCmd.OpenForm "Frm_HlMain", acNormal
Else
DoCmd.OpenForm "Frm_Main", acNormal
 

isladogs

MVP / VIP
Local time
Today, 19:33
Joined
Jan 14, 2017
Messages
18,209
As user appears to be a text field you need text delimiters.
Of course you also need an End If line
 

Users who are viewing this thread

Top Bottom