DO CASE REGISTROS COM IMAGEM FORA DO BANCO
sera que pra funcionar a foto dentro do case do botao
teria que colocar algo assim
Dim rs As New ADODB.Recordset
Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
End Select
teria que colocar algo assim
Dim rs As New ADODB.Recordset
Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]
If Dir(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô]) < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\[Ô] & txtid.Text & [Ô].jpg[Ô])
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
End Select
na realidade vc deve buscar o caminho dentro do banco assim:
teria que colocar algo assim
lógico troque o RS!foto pelo no do campo que guarda o caminho da foto
teria que colocar algo assim
Dim rs As New ADODB.Recordset
Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]
Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]
Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]
Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]
End Select
Set Rs = Conexao Execute(Sql)
If RS!foto < > [Ô][Ô] Then
Picture1.Picture = LoadPicture(RS!foto)
Else
Msgbox [Ô]Arquivo não existe![Ô]
End If
lógico troque o RS!foto pelo no do campo que guarda o caminho da foto
Muito Obrigado Marcelo
me ajudo bastante valew
Private Sub CmdMov_Click(Index As Integer)
Dim rs As New ADODB.Recordset
Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]
Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]
Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]
Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]
End Select
rs.Open Sql, conexao
If Dir(App.Path & [Ô]\FOTOS\[Ô] & txtid & [Ô].bmp[Ô]) <> [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\FOTOS\[Ô] & txtid & [Ô].bmp[Ô])
Else
Picture1.Picture = LoadPicture([Ô][Ô])
End If
[ô]--------------------
If rs.EOF Then [ô] se nao encontrou
Else
MostraDados rs
End If
rs.Close: Set rs = Nothing
End Sub
me ajudo bastante valew
Private Sub CmdMov_Click(Index As Integer)
Dim rs As New ADODB.Recordset
Select Case Index
Case 0 [ô] primeiro
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MIN(id) FROM buscar)[Ô]
Case 1 [ô] anterior
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id < [Ô] & Val(txtid.Text) & [Ô] ORDER BY id DESC[Ô]
Case 2 [ô] proximo
Sql = [Ô]SELECT TOP 1 * FROM buscar [Ô] _
& [Ô]WHERE id > [Ô] & Val(txtid.Text) & [Ô] ORDER BY id[Ô]
Case 3 [ô] ultimo
Sql = [Ô]SELECT * FROM buscar [Ô] _
& [Ô]WHERE id IN (SELECT MAX(id) FROM buscar)[Ô]
End Select
rs.Open Sql, conexao
If Dir(App.Path & [Ô]\FOTOS\[Ô] & txtid & [Ô].bmp[Ô]) <> [Ô][Ô] Then
Picture1.Picture = LoadPicture(App.Path & [Ô]\FOTOS\[Ô] & txtid & [Ô].bmp[Ô])
Else
Picture1.Picture = LoadPicture([Ô][Ô])
End If
[ô]--------------------
If rs.EOF Then [ô] se nao encontrou
Else
MostraDados rs
End If
rs.Close: Set rs = Nothing
End Sub
Tópico encerrado , respostas não são mais permitidas