Hello
I m trying to create a user friendly database. Now I am stuck and I need help
I have a userform whrere you can insert a product ID (artkli number) and then it shows all the information about that product (fills all the blue blocks).
But my problem is that I want it to show me a picture about that product too in a imagebox below. Is it doable and how?
Code i have now:
Private Sub cmdClose_Click()
'Sule programm
Unload Me
End Sub
Private Sub CmdReset_Click()
Unload frmLookup
frmLookup.Show
End Sub
Private Sub cmdSend_Click()
'Loo muutujad
Dim cNum As Integer
Dim X As Integer
Dim nextrow As Range
'Lisa andmekastikeste arv
cNum = 15
Set nextrow = Sheet3.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
For X = 1 To cNum
nextrow = Me.Controls("Reg" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
MsgBox "Andmed on lisatud Tootmistabelisse."
'Kustuta kastikeste sisu
cNum = 15
For X = 1 To cNum
Me.Controls("Reg" & X).Value = ""
Set nextrow = nextrow.Offset(0, 1)
Next
End Sub
Private Sub Reg1_AfterUpdate()
'Kontrolli kas see vaartus on olemas
If WorksheetFunction.CountIf(Sheet2.Range("A:A"), Me.Reg1.Value) = 0 Then
MsgBox "See toode ei ole lisatud andmebaasi."
Me.Reg1.Value = ""
Exit Sub
End If
'Lookup vaartused pohinedes esimesele reale
With Me
.Reg2 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 2, 0)
.Reg3 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 3, 0)
.Reg4 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 4, 0)
.Reg5 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 5, 0)
.Reg6 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 6, 0)
.Reg7 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 7, 0)
.Reg8 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 8, 0)
.Reg9 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 9, 0)
.Reg10 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 10, 0)
.Reg11 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 11, 0)
End With
End Sub
Private Sub UserForm_Click()
End Sub
Raigo
I m trying to create a user friendly database. Now I am stuck and I need help
I have a userform whrere you can insert a product ID (artkli number) and then it shows all the information about that product (fills all the blue blocks).
But my problem is that I want it to show me a picture about that product too in a imagebox below. Is it doable and how?
Code i have now:
Private Sub cmdClose_Click()
'Sule programm
Unload Me
End Sub
Private Sub CmdReset_Click()
Unload frmLookup
frmLookup.Show
End Sub
Private Sub cmdSend_Click()
'Loo muutujad
Dim cNum As Integer
Dim X As Integer
Dim nextrow As Range
'Lisa andmekastikeste arv
cNum = 15
Set nextrow = Sheet3.Cells(Rows.Count, 1).End(xlUp).Offset(1, 0)
For X = 1 To cNum
nextrow = Me.Controls("Reg" & X).Value
Set nextrow = nextrow.Offset(0, 1)
Next
MsgBox "Andmed on lisatud Tootmistabelisse."
'Kustuta kastikeste sisu
cNum = 15
For X = 1 To cNum
Me.Controls("Reg" & X).Value = ""
Set nextrow = nextrow.Offset(0, 1)
Next
End Sub
Private Sub Reg1_AfterUpdate()
'Kontrolli kas see vaartus on olemas
If WorksheetFunction.CountIf(Sheet2.Range("A:A"), Me.Reg1.Value) = 0 Then
MsgBox "See toode ei ole lisatud andmebaasi."
Me.Reg1.Value = ""
Exit Sub
End If
'Lookup vaartused pohinedes esimesele reale
With Me
.Reg2 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 2, 0)
.Reg3 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 3, 0)
.Reg4 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 4, 0)
.Reg5 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 5, 0)
.Reg6 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 6, 0)
.Reg7 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 7, 0)
.Reg8 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 8, 0)
.Reg9 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 9, 0)
.Reg10 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 10, 0)
.Reg11 = Application.WorksheetFunction.VLookup(CStr(Me.Reg1), Sheet2.Range("Lookup"), 11, 0)
End With
End Sub
Private Sub UserForm_Click()
End Sub
Raigo