A
AHP
I would like for the data I select from a combo box to display in individual
text box's on the form I have placed the comb box. The combo box and the
text box's are on the same form.
When I select data from the combo box I place selected data into three
individual variables.
I then set a New ADODB.recordset. After that I store the complete string of
data determine by selection from the combo box in a string variable. The
data stored in the string variable is pulled from the table that populates
the query that populates the combo box.
The code to display selected data on the form in individual text box's is
placed inside a if statement.
FName = ""
LName = ""
num1 = InStr(1, Combo26.Text, Chr(32))
FName = Left(Combo26.Text, (num1 - 1))
LName = Mid(Combo26.Text, (num1 + 1))
Set recd1 = New ADODB.Recordset
myString = "SELECT* FROM DET1PERSONNEL WHERE FIRST_NAME = '" & FName & "'
AND LAST_NAME = '" & LName & "';"
recd1.Open myString, conn1, adOpenKeyset, adLockOptimistic
If Not recd1.BOF And Not recd1.EOF Then
Me.FIRST_NAME.SetFocus
‘ This is where I get my error when I run the code. I also want to display
this data on the form in this text box.
Me.FIRST_NAME.Text = FName
‘ I would like to save this data to a table from this text box
Me.LAST_NAME.SetFocus
Me.LAST_NAME.Text = "LAST_NAME"
Else
MsgBox "This person is not in this database"
End If
The error I get is “ The macro or function set to the BeforeUpdate or
ValidationRule property for this field is preventing Microsoft Office from
saving the data in the fieldâ€
text box's on the form I have placed the comb box. The combo box and the
text box's are on the same form.
When I select data from the combo box I place selected data into three
individual variables.
I then set a New ADODB.recordset. After that I store the complete string of
data determine by selection from the combo box in a string variable. The
data stored in the string variable is pulled from the table that populates
the query that populates the combo box.
The code to display selected data on the form in individual text box's is
placed inside a if statement.
FName = ""
LName = ""
num1 = InStr(1, Combo26.Text, Chr(32))
FName = Left(Combo26.Text, (num1 - 1))
LName = Mid(Combo26.Text, (num1 + 1))
Set recd1 = New ADODB.Recordset
myString = "SELECT* FROM DET1PERSONNEL WHERE FIRST_NAME = '" & FName & "'
AND LAST_NAME = '" & LName & "';"
recd1.Open myString, conn1, adOpenKeyset, adLockOptimistic
If Not recd1.BOF And Not recd1.EOF Then
Me.FIRST_NAME.SetFocus
‘ This is where I get my error when I run the code. I also want to display
this data on the form in this text box.
Me.FIRST_NAME.Text = FName
‘ I would like to save this data to a table from this text box
Me.LAST_NAME.SetFocus
Me.LAST_NAME.Text = "LAST_NAME"
Else
MsgBox "This person is not in this database"
End If
The error I get is “ The macro or function set to the BeforeUpdate or
ValidationRule property for this field is preventing Microsoft Office from
saving the data in the fieldâ€