Thread: Access Form with VB
04-30-04, 03:14 #1Registered User
- Join Date
- Apr 2004
Unanswered: Access Form with VB
I hope somebody can help me with this...
I have created a form in Access with a number if text fields. I would like the user to enter an item number in one of the fields, and then populate another field on the form with the item's weight. Both the item number and weight are in the same table, and it could be that there is more than one record with the same item number and weight (i.e. item number is not the primary key).
Without knowing where to begin, I wrote the following code for my form...
Private Sub Text1_AfterUpdate() Dim artikel As Double Dim strSQL As String artikel = Text1.Value strSQL = "SELECT BAAN_IMPORT.U_ARTIKEL, BAAN_IMPORT.GEWICHT " & _ "FROM BAAN_IMPORT " & _ "GROUP BY BAAN_IMPORT.U_ARTIKEL, BAAN_IMPORT.GEWICHT " & _ "HAVING BAAN_IMPORT.U_ARTIKEL=" & artikel & ";" 'know idea what to do next!!!??? 'Text2.Value = GEWICHT field returned by the above query... End Sub
Any help would be greatly appreciated...
05-02-04, 05:45 #2Cavalier King Charles
- Join Date
- Dec 2002
- Préverenges, Switzerland
have a look at the DLOOKUP() function.
it goes something like this:
text2 = dlookup("[GEWICHT]", "[BAAN_IMPORT]", "U_ARTIKEL=" & artikel)
izycurrently using SS 2008R2