Update an unassigned textbox on load (1 Viewer)

Locopete99

Registered User.
Local time
Today, 02:50
Joined
Jul 11, 2016
Messages
163
Hi Guys,
On my database I have a login screen. I used to open a form and show all subform results based on what team the users were on. Due to the number of records this is getting a bit slow.

So I'm trying to rebuild using just the operators records.

But, there needs to be the ability to see another team mates details in case they are on holiday or off sick. So i'm trying to do an alternative user logon.

Can you see if you can help with the below? I've had a stab but ot really been one for using unassigned text boxes.

Code:
Private Sub Form_Load()

If Forms!frm_ISDAltLogin![Text1] Is Null Then
'This checks if the alternate login field has a  name in it.  
Me.Text0 = fOSUserName
'if not then this puts the current user in the unassigned text0 on this form
Else
Me.Text0 = Forms!frm_ISDAltLogin![Text1]
'if it does it puts this user into the unassigned text box on my form.
End If


End Sub

Its currently erroring with 424 "object required" on the opening IF line.
 

pbaldy

Wino Moderator
Staff member
Local time
Today, 02:50
Joined
Aug 30, 2003
Messages
36,118
Is Null is SQL; in code use the IsNull() function. I'd test for both Null and a zero length string. One way:

If Len(Whatever & "") = 0 Then
 

Mark_

Longboard on the internet
Local time
Today, 02:50
Joined
Sep 12, 2017
Messages
2,111
Alternate to Paul's code, depending on other needs, would be

If nz(WhatEver,"") = "" then

Both work as quickly but there are times when one will be more useful than the other. I've gotten into the habit of using NZ as it works well with case structures.
 

Users who are viewing this thread

Top Bottom