yeah it's me again, if I drive you guys nut, just tell me ;) try to keep in mind that I'm an absolute newbe!
I'm trying to fill my datagrid with a table from an oracle DB but it doesn't do a thing, I don't get any error's so I gues everythings ok, but I propably forgot somthing.
Also I don't understand half of what's in the code so I'll just put the complete form here:
If someone can help me out again I would appreciate it a thousand times!Code:Option Explicit
Private cn As ADODB.Connection 'this is the connection
Private rs As ADODB.Recordset 'this is the recordset
' Available command buttons
Private Enum CommandButtons
BUTTON_TOEVOEGEN
BUTTON_INZIEN
BUTTON_WIJZIGEN
BUTTON_VERWIJDEREN
BUTTON_ZOEKEN
BUTTON_AFDRUKKEN
BUTTON_SLUITEN
End Enum
' Save pointer of form to return to
Dim fMyReturnForm As Form
Dim fThisForm As Form
Private Sub cmdCommand_Click(Index As Integer)
Dim strSQL As String
Dim strValue As String
StoreReturnForm Me ' Set pointer to form to return to
Select Case Index
Case BUTTON_TOEVOEGEN
gsFormParm = CMD_ADDRCD
frmArtikelen.Show
Me.Enabled = False
Case BUTTON_INZIEN
'gsFormParm = CMD_VIEW & "|" & datPrimaryRS.Recordset![ArtikelId]
frmArtikelen.Show
Me.Enabled = False
Case BUTTON_WIJZIGEN
'gsFormParm = CMD_EDITRCD & "|" & datPrimaryRS.Recordset![ArtikelId]
frmArtikelen.Show
Me.Enabled = False
Case BUTTON_VERWIJDEREN
'gsFormParm = CMD_DELRCD & "|" & datPrimaryRS.Recordset![ArtikelId]
frmArtikelen.Show
Me.Enabled = False
Case BUTTON_ZOEKEN
If GeneralDialog(DIATYPE_INVOER, Me.Caption, _
"Artikelnummer?", strValue) = DIABUTTON_OK Then
If (Not IsNull(strValue)) _
And (Len(strValue) <> 0) _
And (IsNumeric(strValue)) Then
strValue = "ArtikelId>=" & strValue
rs.Find strValue
If Not rs.EOF Then ' Gevonden!
grdDataGrid.Refresh
Else
GeneralDialog DIATYPE_MELDING, Me.Caption, "Artikelnummer niet gevonden!", ""
End If
Else
GeneralDialog DIATYPE_MELDING, Me.Caption, "Artikelnummer niet correct!", ""
End If
End If
Case BUTTON_AFDRUKKEN
PrintTableReport frmHoofdMenu.rptReport, RPT_ARTIKELEN
Case BUTTON_SLUITEN
fMyReturnForm.Enabled = True ' Re-enable the return form
fMyReturnForm.Show ' MLS Toegevoegd voor display van bovenliggend menu 19-11-98
Screen.MousePointer = vbDefault
Unload Me
End Select
End Sub
Private Sub Form_Activate()
Dim FindCrit As String
Dim FindParm As String
FindParm = GetParmInString(gsFormParm, 2)
If Len(FindParm) <> 0 Then
Select Case GetParmInString(gsFormParm)
Case CMD_ADDRCD, CMD_EDITRCD, CMD_DELRCD
FindCrit = "ArtikelID>=" & GetParmInString(gsFormParm, 2)
rs.Find (FindCrit)
'If (rs.RecordCount <> 0) And rs.NoMatch Then
If (rs.RecordCount <> 0) And rs.EOF Then
rs.MoveFirst
End If
End Select
End If
End Sub
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
CheckFunctionKey KeyCode, Shift
End Sub
Private Sub Form_KeyPress(KeyAscii As Integer)
Select Case KeyAscii
Case Asc("T"), Asc("t")
cmdCommand_Click (BUTTON_TOEVOEGEN)
Case Asc("I"), Asc("i")
cmdCommand_Click (BUTTON_INZIEN)
Case Asc("W"), Asc("w")
cmdCommand_Click (BUTTON_WIJZIGEN)
Case Asc("V"), Asc("v")
cmdCommand_Click (BUTTON_VERWIJDEREN)
Case Asc("Z"), Asc("z")
cmdCommand_Click (BUTTON_ZOEKEN)
Case Asc("A"), Asc("a")
cmdCommand_Click (BUTTON_AFDRUKKEN)
Case Asc("S"), Asc("s")
cmdCommand_Click (BUTTON_SLUITEN)
Case 27 ' ESC
cmdCommand_Click (BUTTON_SLUITEN)
End Select
End Sub
Private Sub Form_Load()
Dim SQL As String
'Me.MousePointer = 11 'this makes the mouse pointer the hourglass
Set cn = New ADODB.Connection
cn.ConnectionString = "Data Source=SpijsDB;User ID=spijs;Password=spijs;"
cn.Open
Set rs = New ADODB.Recordset
rs.Open "Artikelen", cn, adOpenKeyset, adLockPessimistic, adCmdTable
PositionForm Me, FORMTYPE_BROWSER ' Put form in the right place
rs.Close
SQL = "select * from artikelen"
rs.Open SQL, cn, adLockOptimistic
Set fMyReturnForm = GetReturnForm()
'datPrimaryRS.DatabaseName = spijsDB
If GetSecurityLevel < 2 Then
cmdCommand(BUTTON_TOEVOEGEN).Enabled = False
cmdCommand(BUTTON_WIJZIGEN).Enabled = False
cmdCommand(BUTTON_VERWIJDEREN).Enabled = False
cmdCommand(BUTTON_AFDRUKKEN).Enabled = False
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
Screen.MousePointer = vbDefault
End Sub
WiseGuy
