How to Store Unbound Text values into Table

Solly

New member
Local time
Today, 12:40
Joined
Dec 3, 2014
Messages
2
I have a table called ProductMaster that contains fields such as ProdID, ProdName, ProdRate, ProdReOrdrLvl. I want to give user an option to edit the rate or Re-order level of a product. I am using unbound ComboBox for user to select Product name and rest are unbound TextBox. I have coded “On Change” in Event Tab of ComboBox to display appropriate rate and re-order level on other unbound TextBoxes. Here Im stuck to proceed further. I want to store the modified data into a table back i.e. rate/re-order level. Can anybody help me out how can I achieve this. Thank you
 
You could build an Update query using vba

Here is a sample:
The scenario is there are tutors and classes (with day and time) and a table tutorAvailability showing which tutors are available and when. Once a tutor has been assigned to a class, that tutor is no longer available for assignment for that time period.

The command8 button uses the values selected by the user - indicating this Tutor is currently available to teach this Class at this day and time - and then UPDATES the
TutorAvailability to set the IsAvailable flag to False. Tutor is no longer available at this Day and Time.

Code:
'---------------------------------------------------------------------------------------
' Procedure : Command8_Click
' Author    : Jack
' Date      : 12-10-2011
' Purpose   : Update the IsAvailable flag to False to show this Tutor is now busy
' for this Day and Period.
'---------------------------------------------------------------------------------------
' Last Modified:
'
' Inputs: N/A
' Dependency: N/A
'--------------------------------------------------------------------------
'
Private Sub Command8_Click()
      Dim SQL As String
10       On Error GoTo Command8_Click_Error

20    SQL = "[B]Update[/B] TutorAvailability SET IsAvailable = False " _
      & "WHERE Name = '" & Me.ListAvail.Column(0) & "' AND " _
       & " UniClassname ='" & Me.ListAvail.Column(2) & "' AND " _
       & " IsAvailable = True "
30    Debug.Print "*** " & SQL
40    CurrentDb.Execute SQL, dbFailOnError
50    Debug.Print " Must UPDATE TUTOR HAS BEEN ASSIGNED ALSO"

70       On Error GoTo 0
80       Exit Sub

Command8_Click_Error:

90        MsgBox "Error " & Err.Number & " (" & Err.Description & ") in procedure Command8_Click of VBA Document Form_Form16"
End Sub
 

Users who are viewing this thread

Back
Top Bottom