A simple questions with probably simple solution

hardrock

Registered User.
Local time
Today, 16:26
Joined
Apr 5, 2007
Messages
166
Hey all, With the bit of code below, i select a vendor code from my dropdown list, and then two textboxes lookup the supplier name and telephone number via a filter in my query "supplierdetails" and it returns the values to my form. The query "Supplierdetails" gets its data from a table called Supplier.

Now all this works fine :)

Just need some help in the event i need to modify the record(s)

Say I now make a change to the telephone number, and hit save on my form.... Whats the simplest code i can put in my Save subroutine to capture the changes directly into the table, based on the selected vendor code? Many thanks!



Private Sub Combo1_AfterUpdate()

Vend.Value = Combo1

SUPPLIERa = DLookup("[SUPPLIER]", "SupplierDetails")
TELa = DLookup("[TEL]", "SupplierDetails")
 
Hi Bob, The table i'm trying to write to is not bound to the form, (the form is bound to another table) and that's my problem!... Any suggestions ?
 
HR,

You can execute a SQL statement:

Code:
DoCmd.RunSQL "Insert Into OtherTable (Vendor, Supplier, Tel) " & _
             "Values ('" & Vend & "', '" & SUPPLIERa & "', '" & TELa & "');"

Or

DoCmd.RunSQL "Update OtherTable " & _
             "Set   Vendor = '" & Vend & "', " & _
             "      Supplier = '" & SUPPLIERa & "', " & _
             "      TEL = '" & TELa & " " & _
             "Where ..."

Wayne
 

Users who are viewing this thread

Back
Top Bottom