I got a problem with a recordset in a form who's loaded with this code :
Public Function TrouverMediaNumerique(TypeRecherche As String)
Dim cnxBD As New ADODB.Connection
Dim rsBD As New ADODB.Recordset
Dim Test As String * 6
Test = InputBox("Veuillez entrez le numéro du média : ", "Choix de média")
If Len(Test) <> 6 Or (Left(Test, 1) <> "C" And Left(Test, 1) <> "D") Or Not IsNumeric(Mid(Test, 2, 5)) Then
If Trim(Test) <> "" Then
MsgBox "Vous devez entrer un numéro de bande de 6 caractères " & _
"commençant par les lettres 'C' ou 'D' et suivi de 5 chiffres", vbExclamation, _
"Erreur de numéro de média"
End If
DoCmd.OpenForm "frmMenuMedias", acNormal, , , acFormReadOnly
Else
cnxBD.Provider = "Microsoft.Jet.OLEDB.4.0"
cnxBD.Mode = adModeRead
cnxBD.Open CurrentProject.Path & "\" & CurrentProject.Name
With rsBD
Set .ActiveConnection = cnxBD
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.Open "SELECT * FROM tblMediasNumeriques WHERE NoMedia = '" & Test & "'"
End With
If rsBD.RecordCount > 0 Then
If TypeRecherche = "Modifier" Then
DoCmd.OpenForm "frmMediasNumeriques", acNormal, , , acFormEdit
ElseIf TypeRecherche = "Visualiser" Then
DoCmd.OpenForm "frmMediasNumeriques", acNormal, , , acFormReadOnly
End If
Set Form_frmAjoutBandesVideos.Recordset = rsBD
Else
MsgBox "Média inexistant!", vbExclamation, "Erreur"
DoCmd.OpenForm "frmMenuMedias"
End If
rsBD.Close
Set rsBD = Nothing
cnxBD.Close
Set cnxBD = Nothing
End If
End Function
I dont seem to be able to modify the data further to this affectation :
Set Form_frmAjoutBandesVideos.Recordset = rsBD
Anyone have a clue how to be able to modify data in the form????
Public Function TrouverMediaNumerique(TypeRecherche As String)
Dim cnxBD As New ADODB.Connection
Dim rsBD As New ADODB.Recordset
Dim Test As String * 6
Test = InputBox("Veuillez entrez le numéro du média : ", "Choix de média")
If Len(Test) <> 6 Or (Left(Test, 1) <> "C" And Left(Test, 1) <> "D") Or Not IsNumeric(Mid(Test, 2, 5)) Then
If Trim(Test) <> "" Then
MsgBox "Vous devez entrer un numéro de bande de 6 caractères " & _
"commençant par les lettres 'C' ou 'D' et suivi de 5 chiffres", vbExclamation, _
"Erreur de numéro de média"
End If
DoCmd.OpenForm "frmMenuMedias", acNormal, , , acFormReadOnly
Else
cnxBD.Provider = "Microsoft.Jet.OLEDB.4.0"
cnxBD.Mode = adModeRead
cnxBD.Open CurrentProject.Path & "\" & CurrentProject.Name
With rsBD
Set .ActiveConnection = cnxBD
.CursorType = adOpenKeyset
.LockType = adLockBatchOptimistic
.Open "SELECT * FROM tblMediasNumeriques WHERE NoMedia = '" & Test & "'"
End With
If rsBD.RecordCount > 0 Then
If TypeRecherche = "Modifier" Then
DoCmd.OpenForm "frmMediasNumeriques", acNormal, , , acFormEdit
ElseIf TypeRecherche = "Visualiser" Then
DoCmd.OpenForm "frmMediasNumeriques", acNormal, , , acFormReadOnly
End If
Set Form_frmAjoutBandesVideos.Recordset = rsBD
Else
MsgBox "Média inexistant!", vbExclamation, "Erreur"
DoCmd.OpenForm "frmMenuMedias"
End If
rsBD.Close
Set rsBD = Nothing
cnxBD.Close
Set cnxBD = Nothing
End If
End Function
I dont seem to be able to modify the data further to this affectation :
Set Form_frmAjoutBandesVideos.Recordset = rsBD
Anyone have a clue how to be able to modify data in the form????