I have a form bound to an access table via ADO. Several txt boxes that get their value based on what the user selects with several option boxes. If new record, all is well. If editing existing record, controls function normally, and txt boxes show new values. If the user only uses the option boxes to edit the values, and clicks save, the record is not updated in the database, and no errors are generated. However, if the user manually enters any txtbox and makes any change, all updates are saved correctly, including those changed with the option boxes. Make me think there is some change flag set somewhere that I do not know about that needs to be set in the click event of the option boxes.
Code that does updates to fields:
Dim FirstDate As Date ' Declare variables.
Dim IntervalType As String
Dim Number As Integer
Dim newdate As String
If Option1(0) = True Then
IntervalType = "m" ' "m" specifies months as interval.
frmSelDate.Show 1
FirstDate = selDate
Number = 6
newdate = CStr(DateAdd(IntervalType, Number, FirstDate))
txtMedIssue = selDate
txtMedExpires = newdate
txtMedClass = "Class I"
End if
The three fields above are two text fields and a date field. Very strange that if I change value with the option box and then manually change another field on the form, all gets saved, but if I use only controls (option box, etc) nothing gets updated on save.
Below is the code on the save button.
Private Sub Save_Click()
datPrimaryRS.Recordset.UpdateBatch adAffectAll
Update_Splash.Show 1
cmdCancel_Click
Exit Sub
Thanks for looking at this.
Code that does updates to fields:
Dim FirstDate As Date ' Declare variables.
Dim IntervalType As String
Dim Number As Integer
Dim newdate As String
If Option1(0) = True Then
IntervalType = "m" ' "m" specifies months as interval.
frmSelDate.Show 1
FirstDate = selDate
Number = 6
newdate = CStr(DateAdd(IntervalType, Number, FirstDate))
txtMedIssue = selDate
txtMedExpires = newdate
txtMedClass = "Class I"
End if
The three fields above are two text fields and a date field. Very strange that if I change value with the option box and then manually change another field on the form, all gets saved, but if I use only controls (option box, etc) nothing gets updated on save.
Below is the code on the save button.
Private Sub Save_Click()
datPrimaryRS.Recordset.UpdateBatch adAffectAll
Update_Splash.Show 1
cmdCancel_Click
Exit Sub
Thanks for looking at this.