Message 1 of 24
Saving & Restoring User Info on Forms
Not applicable
01-05-2005
01:17 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
From the little vba that i know, if you want to save form/user information you have three choices: text file, database, or the registry.
I'd like to streamline my 'save' & 'get' functions...
I'm not too swift with writing to text files, so i typically use a db & tables.
Here's a little snipet of code that i use:
' get login name
strLoginName = UCase(ThisDrawing.GetVariable("loginname"))
'if there is at least one record
If Not oRS.EOF Then
retry:
With oRS
' search for matching login name
.Index = "PrimaryKey"
.Seek "=", strLoginName
' if we find a match, edit the fields
If .NoMatch = False Then
.Edit
Else
.AddNew
End If
!txtUser = strLoginName
!txtProject = strProjectName
!txtSanLatLayer = Me.cboLayerSanitary.Value
!txtWtrLatLayer = Me.cboLayerWater.Value
!txtStmLatLayer = Me.cboLayerStorm.Value
.Update
End With
Else
With oRS
.AddNew
!txtUser = strLoginName
.Update
End With
GoTo retry
End If ' EOF
oRS.Close
oDB.Close
I'd like to streamline my 'save' & 'get' functions...
I'm not too swift with writing to text files, so i typically use a db & tables.
Here's a little snipet of code that i use:
' get login name
strLoginName = UCase(ThisDrawing.GetVariable("loginname"))
'if there is at least one record
If Not oRS.EOF Then
retry:
With oRS
' search for matching login name
.Index = "PrimaryKey"
.Seek "=", strLoginName
' if we find a match, edit the fields
If .NoMatch = False Then
.Edit
Else
.AddNew
End If
!txtUser = strLoginName
!txtProject = strProjectName
!txtSanLatLayer = Me.cboLayerSanitary.Value
!txtWtrLatLayer = Me.cboLayerWater.Value
!txtStmLatLayer = Me.cboLayerStorm.Value
.Update
End With
Else
With oRS
.AddNew
!txtUser = strLoginName
.Update
End With
GoTo retry
End If ' EOF
oRS.Close
oDB.Close