Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with a recodset, i can't modify data in it

Status
Not open for further replies.

FadeOut

Programmer
Mar 27, 2004
14
0
0
CA
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????
 
You might want to try:

Code:
frmAjoutBandesVideos.RecordSource = rsBD

I dont think you can directly bind the recordset to the form, instead the record source preperty allows you to do this.

Regards,
John
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top