Newsgroup: it.comp.appl.access
Titolo: File.ini

Ciao a tutti,
ho creato un'applicazione con Access2000, vorrei impostare un file tipo .INI
che mi permetta di caricare le opzioni di configurazione all'apertura
dell'applicazione, qualcuno mi puň dare una mano?
Grazie T

 ha scritto nel messaggio
news:0W06c.76979$FJ6.2...@twister1.libero.it...

Non č piů pratico usare una apposita tabella, magari nascosta?
Ciao
Galliano.

 ha scritto nel messaggio
news:VQ26c.77228$FJ6.2...@twister1.libero.it...

Non credo, il File INI lo modifichi senza aprire il DB....e
si usano proprio per questo.......!!!!
Supponi di proteggere il BE.....
Io ti consiglierei di Scrivere Azione=Valore...!
Per esempio Se vuoi che il Colore Delle Form sia Nero:
BackColor=0
ForeColor=1
E' ovviamente un'esempio Banale...... ma non sň quello che devi fare..!!!
@Alex.

 all'apertura dell'applicazione, qualcuno mi pur dare una mano?
Una classe semplice semplice che utilizzo di tanto in tanto.
--------------------------- cut -------------------------------------
Attribute VB_Name = "CIniFiles"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = True
Option Compare Database
Option Explicit
Private strFileName As String
Private Declare Function GetPrivateProfileStringA Lib "kernel32" (ByVal
strSection As String, _
   ByVal strKey As String, ByVal strDefault As String, ByVal
strReturnedString As String, _
   ByVal lngSize As Long, ByVal strFileNameName As String) As Long
Private Declare Function WritePrivateProfileStringA Lib "kernel32"
(ByVal strSection As String, _
   ByVal strKey As String, ByVal strString As String, ByVal
strFileNameName As String) As Long
Private Function WritePrivateProfileString32(ByVal strFileName As
String, ByVal strSection As String, ByVal strKey As String, ByVal
strValue As String) As Boolean
Dim lngValid As Long
    On Error Resume Next
    lngValid = WritePrivateProfileStringA(strSection, strKey, strValue,
strFileName)
    If lngValid > 0 Then WritePrivateProfileString32 = True
    On Error GoTo 0
End Function
Private Function GetPrivateProfileString32(ByVal strFileName As String,
ByVal strSection As String, ByVal strKey As String, Optional
strDefault) As String
Dim strReturnString As String, lngSize As Long, lngValid As Long
    On Error Resume Next
    If IsMissing(strDefault) Then strDefault = ""
    strReturnString = Space(1024)
    lngSize = Len(strReturnString)
    lngValid = GetPrivateProfileStringA(strSection, strKey, strDefault,
strReturnString, lngSize, strFileName)
    GetPrivateProfileString32 = Left(strReturnString, lngValid)
    On Error GoTo 0
End Function
Public Property Get FileName() As String
    FileName = strFileName
End Property
Public Property Let FileName(strValue As String)
    If Trim(strValue) <> "" Then
        strFileName = strValue
    Else
        Err.Raise vbObjectError + cErrorID_ConfigFileName_NotValid,
objProject.Name & ".CVersion", _
        cErrorString_ConfigFileName_NotValid
    End If
End Property
Public Function ReadIniString(strSection As String, strField As String)
As String
    If Dir(strFileName) <> "" Then
        ReadIniString = GetPrivateProfileString32(strFileName,
strSection, strField)
    Else
        Err.Raise vbObjectError + cErrorID_ConfigFileName_NotValid,
objProject.Name & ".CVersion", _
        cErrorString_ConfigFileName_NotValid
    End If
End Function
Public Sub WriteIniString(strSection As String, strField As String,
strValue As String)
    If strFileName <> "" Then
        WritePrivateProfileString32 strFileName, strSection, strField,
strValue
    Else
        Err.Raise vbObjectError + cErrorID_ConfigFileName_NotValid,
objProject.Name & ".CVersion", _
        cErrorString_ConfigFileName_NotValid
    End If
End Sub
Public Function ReadIniInteger(strSection As String, strField As
String) As Integer
    If Dir(strFileName) <> "" Then
        ReadIniInteger = Val(GetPrivateProfileString32(strFileName,
strSection, strField))
    Else
        Err.Raise vbObjectError + cErrorID_ConfigFileName_NotValid,
objProject.Name & ".CVersion", _
        cErrorString_ConfigFileName_NotValid
    End If
End Function
Public Sub WriteIniInteger(strSection As String, strField As String,
intValue As Integer)
    If strFileName <> "" Then
        WritePrivateProfileString32 strFileName, strSection, strField,
Str(intValue)
    Else
        Err.Raise vbObjectError + cErrorID_ConfigFileName_NotValid,
objProject.Name & ".CVersion", _
        cErrorString_ConfigFileName_NotValid
    End If
End Sub
Public Function ReadIniBoolean(strSection As String, strField As
String) As Boolean
    If GetPrivateProfileString32(strFileName, strSection, strField) =
"Vero" Then
        ReadIniBoolean = True
    Else
        ReadIniBoolean = False
    End If
End Function
Public Sub WriteIniBoolean(strSection As String, strField As String,
boolValue As Boolean)
    If boolValue Then
       WritePrivateProfileString32 strFileName, strSection, strField,
"Vero"
    Else
       WritePrivateProfileString32 strFileName, strSection, strField,
"Falso"
    End If
End Sub
Public Function ReadIniAcDataTransferType(strSection As String,
strField As String) As AcDataTransferType
    Select Case GetPrivateProfileString32(strFileName, strSection,
strField)
    Case "Export"
        ReadIniAcDataTransferType = acExport
    Case "Import"
        ReadIniAcDataTransferType = acImport
    Case "Link"
        ReadIniAcDataTransferType = acLink
    Case Else
        ReadIniAcDataTransferType = -1
    End Select
End Function
Public Sub WriteIniAcDataTransferType(strSection As String, strField As
String, acValue As AcDataTransferType)
    Dim tmpStr As String
    Select Case acValue
    Case acExport
        tmpStr = "Export"
    Case acImport
        tmpStr = "Import"
    Case acLink
        tmpStr = "Link"
    Case Else
        tmpStr = ""
    End Select
    WritePrivateProfileString32 strFileName, strSection, strField,
tmpStr
End Sub
Public Function ReadIniAcObjectType(strSection As String, strField As
String) As AcObjectType
    Select Case GetPrivateProfileString32(strFileName, strSection,
strField)
    Case "Table"
        ReadIniAcObjectType = acTable
    Case "DataAccessPage"
        ReadIniAcObjectType = acDataAccessPage
    Case "Default"
        ReadIniAcObjectType = acDefault
    Case "Diagram"
        ReadIniAcObjectType = acDiagram
    Case "Form"
        ReadIniAcObjectType = acForm
    Case "Function"
        ReadIniAcObjectType = acFunction
    Case "Macro"
        ReadIniAcObjectType = acMacro
    Case "Module"
        ReadIniAcObjectType = acModule
    Case "Query"
        ReadIniAcObjectType = acQuery
    Case "Report"
        ReadIniAcObjectType = acReport
    Case "ServerView"
        ReadIniAcObjectType = acServerView
    Case "StoredProcedure"
        ReadIniAcObjectType = acStoredProcedure
    Case Else
        ReadIniAcObjectType = acDefault
    End Select
End Function
Public Sub WriteIniAcObjectType(strSection As String, strField As
String, acValue As AcObjectType)
    Dim tmpStr As String
    Select Case acValue
    Case acTable
        tmpStr = "Table"
    Case acDataAccessPage
        tmpStr = "DataAccessPage"
    Case acDefault
        tmpStr = "Default"
    Case acDiagram
        tmpStr = "Diagram"
    Case acForm
        tmpStr = "Form"
    Case acFunction
        tmpStr = "Function"
    Case acMacro
        tmpStr = "Macro"
    Case acModule
        tmpStr = "Module"
    Case acQuery
        tmpStr = "Query"
    Case acReport
        tmpStr = "Report"
    Case acServerView
        tmpStr = "ServerView"
    Case acStoredProcedure
        tmpStr = "StoredProcedure"
    Case Else
        tmpStr = ""
    End Select
    WritePrivateProfileString32 strFileName, strSection, strField,
tmpStr
End Sub
-- 
I am what I am, I do what I can
Cerchi un programmatore PHP/MySQL? 
http://url.repository.biz/go/1Y
L'uomo, conscio di sbagliare, persevera.

 Grazie T
Io ho un esempio già pronto, che ho mandato al 
www.sitocomune.com
 ma non è
stato ancora pubblicato. Se vuoi vederlo te lo mando se mi dici che
versione di access usi.
Namor
-- 
namor at inwind punto it
questo articolo e` stato inviato via web dal servizio gratuito 
http://www.newsland.it/news
 segnala gli abusi ad 
ab...@newsland.it

 Ciao Namorio sarei interessato  Vs. A xp 
rinof...@virgilio.it
grazie
Ferrari Rino


Ciao potresti mandarlo anche a me?
Io uso Access 2000..   
ala...@tiscali.it
Grazie

 >> Namor
Ciao scusa per il ritardo ma il lavoro....
comunque uso Access 2000 e 2003
mi accontento anche solo per Access2000, modesto no!
Grazie Tommy