Hi, I have following problem:
I have a form where by entering value(ID of product) and pressing ENTER rest of field (price, description) is loaded automatically. For doing so I added this code to On Key Pressed event:
Code:
Private Sub pole_numer_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
Dim test As Double
Dim ada As Integer
Dim check As Integer
Dim bla As Integer
check = -1
Dim rekordy As DAO.Recordset
test = Val(pole_numer.Text)
Set rekordy = CurrentDb.OpenRecordset("Produkty") //PRodukty = table
Do While Not rekordy.EOF
If rekordy!id_produktu = test Then
nazwa.Value = rekordy!nazwa
cena.Value = rekordy!cena
check = 0
ilosc.SetFocus
Exit Do
End If
rekordy.MoveNext
Loop
Set rekordy = Nothing
End If
If check = -1 Then
bla = MsgBox("Nie znaleziono", vbDefaultButton1, "Error") //Not found product
nazwa.Value = ""
cena.Value = ""
ilosc.Value = ""
End If
End Sub
It is working great but I want to be able to select more records but forms don't add new field to itself.
It is hard for me to explain. But basicly I want to enter one product and then I want form to create new fields so I can enter another product again.
I will upload 2 databases for You to show what I want to achieve.
First database: http://www.sendspace.com/file/ttn690 (Sorry for Polish names etc)
On form Zamówienia You have a "Szczegół" button, by clicking it You enter: "Szczegoly zamowienia" form where You can see what I want to do.
Second database: http://www.sendspace.com/file/ho83iz
On form Zamowienia_pod1 You have a form which doesn't work the way I want.
I will appreciate any kind of help here.
Thanks.