RE: value in combo box



How many columns does your combo have?
Which column is the bound column?
Will the bound column be the one you expect to contain the vaule?
--
Dave Hargis, Microsoft Access MVP


"vandy" wrote:

Hi Klatuu,

PID is a number and I have debugged the code and the PID gets displayed.
if rs.nomatch only than should i get the msg displayed. I am getting this
popup msg every time i click on the combo box.

Any help would be greatly appreciated.


"Klatuu" wrote:

The only obvious point of question is the data type of [PID]
If it is numeric, this is not the problem, if it is text, then you need the
proper delimiters:
rs.FindFirst "[PID] = '" & Me.cmbpno & "'"

--
Dave Hargis, Microsoft Access MVP


"vandy" wrote:

Hi all,

I have to check if the project no is not in the combo list and if it is not
than the system should pop a msg telling project no not found do you want to
add and than add the data in the list.

if it is a small combo box than one can see the values but if it is an
extended list it is good to have a confirmation msg.

I used 2 events - after update to check for values and not in list to update
the combo. Here is my problem the msg box is not firing as intended and can i
program in the not inlist event to check for both.

I used allenbrow's code as follows

Private Sub cmbpno_AfterUpdate()

Dim rs As DAO.Recordset

If Not IsNull(Me.cmbpno) Then
'Save before move.
If Me.Dirty Then
Me.Dirty = False
End If
'Search in the clone set.
Set rs = Me.RecordsetClone
rs.FindFirst "[PID] = " & Me.cmbpno

If rs.NoMatch Then
MsgBox "Project DOES NOT EXIST?"
Else
'Display the found record in the form.
Me.Bookmark = rs.Bookmark
End If
Set rs = Nothing
End If

End Sub
(here i get this msg even if there is a match found)

Private Sub cmbpno_NotInList(NewData As String, Response As Integer)

Dim rstproject As ADODB.Recordset
Dim intAnswer As Integer

intAnswer = MsgBox("Do you want to Add " & NewData & " to the list of
projects?", _
vbQuestion + vbYesNo)

If intAnswer = vbYes Then
DoCmd.OpenForm "Add projects", acNormal, "", "", acFormAdd, acDialog
Me.cmbpno.SetFocus
Me.cmbpno.Undo
Response = acDataErrContinue


End If

End Sub

thanks for your help in advance


.



Relevant Pages

  • RE: value in combo box
    ... I had the wrong key feild value PID now when i give it the correct ProjectID ... Which column is the bound column? ... if rs.nomatch only than should i get the msg displayed. ... Private Sub cmbpno_NotInList ...
    (microsoft.public.access.formscoding)
  • Re: Can I disable a macro in "Thisworkbook" with true or false?
    ... Private Sub Workbook_BeforePrint ... And only allow them to print via a button on each worksheet. ... checkbox completely. ... Dim Msg As String ...
    (microsoft.public.excel.programming)
  • RE: value in combo box
    ... The only obvious point of question is the data type of ... extended list it is good to have a confirmation msg. ... Private Sub cmbpno_NotInList ... Dim rstproject As ADODB.Recordset ...
    (microsoft.public.access.formscoding)
  • Re: Form BeforeUdate not behaving
    ... Msg comes up, and, at the same time, cursor goes ... comes up and cursor goes to required field. ... Private Sub Form_BeforeUpdate ...
    (microsoft.public.access.forms)
  • Edit --> Delete & Delete Button on a form.
    ... Private Sub Form_AfterDelConfirm ... delete msg - turned off in B4 Del Confirm ... gintMbResp = MsgBox(gstrMbText, glngMbButton, gstrMbTitle) ... ' A custom Ok to Delete Member Msg Box is done in the BeforeDelConfirm ...
    (microsoft.public.access.modulesdaovba)

Loading