Results 1 to 6 of 6
  1. #1
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Message Boxes (A2K)

    Due to Mark's

    (a) incredible patience ([img]/forums/images/smilies/cool.gif[/img] S/M tendancies, or kind heartedness (tick as appropriate)

    He helped me with the following which let me update a name and address field in form 1 from form 2

    Private Sub cboCustomerId_NotInList(NewData As String, Response As Integer)
    DoCmd.OpenForm "frmCustomer", , , , , acDialog
    cboCustomerId.Undo
    cboCustomerId.Requery
    End Sub

    My Question now is, can I and if so how, have a message appear to tell a user that the record they are trying to input does not exist and that they are being redirected to form 2 to set up a new record, which upon closing will return them to form 1.

    I have read the 10 Minute A2K Guide, The Complete Reference A 2000 (Virginia Anderson) and A2000 Programming Weekend crash (and burn) course but all references seem to say that the message box is set in the form properties and not a field property?

    Any help appreciated

    TIA

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Boxes (A2K)

    My name is not Marc but :
    (a) I don't know my level of patience ([img]/forums/images/smilies/cool.gif[/img] I have S/M tendancies (I work with MS programs) sometimes have a little bit of it

    Between the lines Private... and DoCmd... insert :

    Private Sub cboCustomerId_NotInList(NewData As String, Response As Integer)
    MsgBox "Your Text", vbOKOnly, "Title of your messagebox"
    DoCmd.OpenForm "frmCustomer", , , , , acDialog

    You can format your text in different lines like this:
    Msgbox "Your Text Line 1" & vbCrLf & "Your text Line 2" , vbOkOnly, "Title of your messagebox"

    Hope this help
    Francois

  3. #3
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Boxes (A2K)

    Thank you so much Francois

    I am going out today to buy a cap so that I can 'doff' it to all you people that spare us mere mortals your time and expertise.

    I noticed that creating the message box disabled the MS message box so I experimented and before my requery line added another message box along the lines of "Now please select the new account from the drop down box" which worked fine but the MS box saying a similar thing still appears, is that easy to get rid off or am I in above my Wellington boots.

    Thanks

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

  4. #4
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Boxes (A2K)

    Steve,
    If you mean messageboxes from access try
    DoCmd.SetWarnings False
    Don't forget to use
    DoCmd.SetWarnings True
    If you wan to turn them on again.
    Francois

  5. #5
    5 Star Lounger
    Join Date
    Aug 2001
    Location
    Surrey, United Kingdom
    Posts
    1,001
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Boxes (A2K)

    Thanks Francois

    But where do I put this (think carefully before you type something you shouldn't). I made the assumption that it was above and below the original code in my NotInList event procedure but it doesn't seem to work.

    It lets me type in the false part without a query but when I type in the True part it says it is looking for an arguement.

    Any ideas please

    Steve
    Cheers

    Steve

    Asking the questions everbody wants the answers too but feels too stupid to ask themselves :-)

  6. #6
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Sint Niklaas, Belgium
    Posts
    2,778
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Message Boxes (A2K)

    Steve,
    I've take a closer look to the NotInList event in the Help file.
    Maybe you don't have to use the setwarnigs commands, but the Response arguments acDataErrAdded and acDataErrContinue.
    Look to the sample of NotInList event.
    Francois

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •