Re: Delete record

Tech-Archive recommends: Fix windows errors by optimizing your registry



What data type is Codigo? If it's numeric, change your code to:

..FindFirst "Codigo=" & Me.lstDic.Column(0)

If it's text, then are you sure that first column actually contains a value?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Job via AccessMonster.com" <u17291@uwe> wrote in message
news:5ae6c4df8e6b1@xxxxxx
> Dirk Goldgar wrote:
> >> Hi, I have an old problem.
> >>
> >[quoted text clipped - 33 lines]
> >>
> >> Jorge Barreto
> >
> >I think what you're looking for is
> >
> > .FindFirst "Code='" & Me.lstDic.Column(0, varItem) & "'"
> >
> >Or, if Column(0) is the bound column, you could just use
> >
> > .FindFirst "Code='" & Me.lstDic.ItemData(varItem) & "'"
> >
> Douglas and Dirk, thanks for you help.
>
> Making what it was suggested, the code was thus:
>
> Private Sub cmdExcluir_Click()
> Dim MySet As DAO.Recordset, varItem As Variant
>
> Set MySet = CurrentDb.OpenRecordset("qryDic", dbOpenDynaset)
>
> With Me.lstDic
> For Each varItem In lstDic.ItemsSelected
> With MySet
> ' .FindFirst "Codigo='" & Me.lstDic.Column(0, varItem) &
"'"
> ' .FindFirst "Codigo='" &
Me.lstDic.ItemData(varItem).Column(0)
> & "'"
> ' .FindFirst "Codigo='" & Me.lstDic.ItemData(varItem) & "'"
> .FindFirst "Codigo='" & Me.lstDic.Column(0) & "'"
> If .NoMatch = False Then
> .Delete
> End If
> End With
> Next varItem
> End With
> MySet.Close
> Set MySet = Nothing
> Me.Requery
> End Sub
>
> However, all the alternatives do not function. Emitting the following
error:
> "Incompatible type of data in the criteria expression."
>
> Curiously:
> When I leave for the design mode and I come back toward the form, the data
of
> the register to be deleted are copied on the first register of the table.
>
> It will be that this aid?
>
> Sorry my english, please!!!
>
> --
> Message posted via AccessMonster.com
> http://www.accessmonster.com/Uwe/Forums.aspx/access-forms/200601/1


.



Relevant Pages

  • Re: Error using ado to read cvs file
    ... the name of the file and I found out I can't use wild card like: ... By default the driver uses first row's data type to ... determine, in your case, the first column in first row is a number, ...
    (microsoft.public.data.ado)
  • Re: Trouble opening a form from a subform combo box
    ... combobox's Row Source query, as you don't see the first column because ... its Column Widths property sets the first column to 0" wide, ... tblPartnumber table, which is an AutoNumber. ... > Part_Number (data type text) ...
    (microsoft.public.access.forms)
  • Re: Single precision in Simulink?
    ... "Complex signals of any data type and non-double real signals must be ... in structure format. ... The first column must contain time values and the ...
    (comp.soft-sys.matlab)
  • Export to excel leaves off leading 0s
    ... I suppose the data in the first column is something like ... The excel is identify data type of the ... >How do I need to alter the code to prevent the truncation? ...
    (microsoft.public.dotnet.framework.aspnet.datagridcontrol)