Upgrading from 2000 to 2003 - Run-time error -2147352567

johndoomed

VBA idiot
Local time
Yesterday, 21:20
Joined
Nov 4, 2004
Messages
174
Hi all! Since the weather has been shit all summer, I have (finally) started to upgrade from 2000 till 2003. On the whole this seems to go quite well, but there is one problem I can't seem to solve. I've decided to start over again with this script.

The problem is the onload script on my main from (Startup form). I'm using this to identify the user. The form is connected to a table containing the different users (Person_ID).

I get a run-time error (-2147352567), and a message that I cannot "assign a value" (My Access is in norwegian, so the message could sound a bit different ;-)

PHP:
Private Sub Form_Load()
    User = Environ("USERNAME")
    Person = Me.[Person_ID]
    
    If User = "jel" Then
        Me.[Person_ID] = "1"
        Me.Admin.Visible = True
        GoTo Ending
    ElseIf User = "kro" Then
        Me.[Person_ID] = "2"
        Me.Admin.Visible = False
        GoTo Reguser
    Else
        MsgBox ("User not not found.")
        Me.Admin.Visible = False
        GoTo Reguser
    End If
    
Reguser:
    Dim i As Integer
    For i = 1 To CommandBars.Count
    CommandBars(i).Enabled = False
    Next i
Ending:
    
End Sub

Anyways.. Hope you guys can help me yet again!
 
On what line does the error occur?
 
Total guess

But since "User" is a Class in the DAO library, maybe it is objecting to your attempting to use it as a variable? Maybe try renaming the "User" variable in your code to something else, see if it still happens. But this is a random, shot-in-the-dark guess.
 
lagbolt: Sorry for not giving you all the info needed. The error occurs on this line:
PHP:
Me.[Person_ID] = "1"
Looking at it now, it seems that the problem is that i can't update the textbox Person_ID. (The query works and the box is updateble..).
 
How is person_id defined? Is it a string or a number. Have you defined an iput mask for it?

If it is a number then you wont need the the Quotes round it.
 

Users who are viewing this thread

Back
Top Bottom