Access97. I have a form, that has a combo box showing an authors name. User must select a name from the list, or if the name isn't in the list, the name must be added first.
The name consists of lastname and firstname. What I want is the name entered in the author name combo box, ie
Smith, David to appear in the first and last name boxes in the frmAddNewAuthor form.
here's what I have so far. Sometimes it works, sometimes it strips off the odd character. There must be a better, more reliable way of doing it. anyway here is what I have so far.
Dim intNewCategory As Integer
Dim intTruncateName As Integer
Dim strTitle As String
Dim intMsgDialog As Integer
Me![cbominAuthor] = Null
Response = 0
strTitle = "Author Not In List"
intMsgDialog = vbYesNo + vbQuestion + vbDefaultButton1
intNewCategory = MsgBox("Do you want to add a new Author?", intMsgDialog, strTitle)
If intNewCategory = vbYes Then
' Open form.
DoCmd.OpenForm "frmAddNewAuthor", , , , acFormAdd
Forms![frmAddNewAuthor]![txtAuthorFirst] = Right(NewData, Len(NewData) - InStr(NewData, ",") - 1)
Forms![frmAddNewAuthor]![txtAuthorLast] = Left(NewData, Len(NewData) - InStr(NewData, ",") - 1)
any better ideas of what code I should use above.
the form [frmAddNewAuthor] has two txt boxes to hold the first and last names.
The following code is on the Close cmdbutton
Private Sub cmdClose_Click()
On Error GoTo Err_cmdClose_Click
Dim x As Variant
x = Me![cbominAuthor]
Forms![frmMin].[cbominAuthor] = x
as I say this seems to work sometimes,but not always.