Form Question "Continued"

MS Office Access

    Next

  • 1. Taskmaster access
    Dear Newsgroup, I have been using Win 98 2nd Ed for a long time. The recent furor about the LovSan infection has caused me to be a little concerned but I am not sure that it applies to Win 98. My newspaper says to click on "Processes" in the Task Manager but I don't have any idea how to do that. Can anyone give me some decent info? Thank you, George Boyle.
  • 2. Pesky #Name? errors
    Is there a simple reason why a select statement that works as a row source in a list box won't work in a text box? (I get the #Name? error). The select statement returns a single field: SELECT testbench.Benchmark FROM testbench; The form is bound to an unrelated table fyi. I'm using a bunch of unbound controls in this way to get control over the display of info from another table. Thanks for any help. Paul

Form Question "Continued"

Postby Um9kbmV5 » Fri, 14 Jul 2006 12:49:01 GMT

I have recently asked this question ?

I have a form which has the following fields, CourseName, courseStartDate, 
CourseFinishDate and a subform with the fields ExamName, ExamDate.
I would like to put an after update event procedure on ExamDate to 
Restrict entry to greater then coursestartdate and less then 
coursefinishdate also with an error message if the ExamDate is outside the 
course Start and finish date.
Is this possible

And I received the following help which was really appreciated.

To compare fields, you need to use the BeforeUpdate event of the form, 
rather than the AfterUpdate of the text box. That way, it catches the error 
and prevents the save even if the user goes back and changes one of the other 
text boxes after entering the ExamDate.

This kind of thing:

Private Sub Form_BeforeUpdate(Cancel As Integer)
     If (Me.ExamDate < Me.CourseStartDate) OR _
     (Me.ExamDate > Me.CourseFinishDate) Then
         Cancel = True
         MsgBox "Exam must be during the course." & vbcrlf & _
             "Correct the entry, or press <Esc> to undo."
     End If
 End Sub

I have tried this suggestion but can't seen to get it to work.

This is what I actually have

I have a Form called frmAddExamToDivision this form has 4 fields called 
CourseName, DivisionName, StartDate, FinishDate and a Subform called 
frmAddExamToDivisionSubform.

The frmAddExamToDivisionSubform has 3 field called ExamName, ExamDate, 
InstructorDetails.

I have tried this but no luck

Private Sub Form_BeforeUpdate(Cancel As Integer)

    If (Me.ExamDate < Me.StartDate) Or _
    (Me.ExamDate > Me.FinishDate) Then
        Cancel = True
        MsgBox "Exam must be during the course." & vbCrLf & _
            "Correct the entry, or press <Esc> to undo."
    End If
End Sub

I also tried this

Private Sub Form_BeforeUpdate(Cancel As Integer)
    If
(Me.Forms.frmAddExamToDivision.frmAddExamtoDivisionSubform.Form.ExamDate
 < Me.Forms.frmAddExamToDivision.StartDate) Or _
 (Me.Forms.frmAddExamToDivision.frmAddExamtoDivisionSubform.Form.ExamDate 
        Cancel = True
        MsgBox "Exam must be during the course." & vbCrLf & _
            "Correct the entry, or press <Esc> to undo."
    End If
End Sub

And still no luck 
Can you please lend some more assistance?

Thank you
Rodney


Re: Form Question "Continued"

Postby Svetlana » Fri, 14 Jul 2006 15:34:19 GMT

You must put the code on subform's before update event

If Me.ExamDate < Forms!frmAddExamToDivision!StartDate Or _
Or Me.ExamDate > Forms!frmAddExamToDivision!FinishDate  Then
      Cancel=True
      MsgBox "Exam must be during the course." & vbCrLf & _
      "Correct the entry, or press <Esc> to undo." 
End If


Re: Form Question "Continued"

Postby Um9kbmV5 » Fri, 14 Jul 2006 20:23:01 GMT

Svetlana,
Thank you so much it works like a dream.

Rodney





Similar Threads:

1.Continuing Question:

2.Select Query Question Continued

Thank you so very much!  I'm so close I can "taste it!"  I wrote a query to 
pull out one unique route number along with the FirstOf fields from my 
original Route Info table using the suggested method below -- let's call it 
the Route Info query.  Now, of course, I have a new issue.  It can't possibly 
be that hard to solve . . . but I obviously can't figure it out on my own . . 
.   :-(

Previously I was performing a Select Query on a table consisting of a list 
of equipment and the routes to which each piece was assigned -- let's call it 
the Equipment table.  This query took the route number from the Equipment 
table, counted all the pieces of equipment and then combined those results 
with the route information on the original Route Info table with which I had 
the multiple route number issues.  Let's call this the Combo query.

I have since adjusted the Combo query to pull in the route Information from 
the Route Info query I created with John's help rather than the original 
Route Info table.  Now I no longer get the multiple route lines, however, not 
ALL of the routes in the Equipment table are actually in the Route Info table 
so . . .

When the Combo query had been getting route info from the Route Info table, 
it would just list those route numbers and their equipment counts with no 
corresponding route information.  Now, with the Combo query getting route 
info from the Route Info QUERY, it just leaves out any route that does not 
have route info on the original Route Info table.

Whew!  I don't know if I explained this in any recognizable fashion but I 
was so thrilled with the advice on my earlier problem, I just had to give 
this a shot!



"John W. Vinson" wrote:
> 
> Tables don't HAVE "first records". A table should be seen as an unordered
> "heap" of data. If there are two records in your Table2 with Route# 3301, you
> will need some OTHER field within that table to identify which you consider
> "correct".
> 
> If it's arbitrary, and you just want to pull whatever record Access happens to
> choose (uncontrolled and unspecific!!!) you can create a Query
> 
> SELECT DISTINCT [Route#] FROM Table2;
> 
> or if you're pulling other fields
> 
> SELECT [Route#], First([This]) As FirstOfThis, First([That]) AS FirstOfThat,
> <etc>
> FROM Table2
> GROUP BY [Route#];
> 
> to pull one record for each value of Route#.
> 
> Note that # is a date delimiter and it's best not to use it in fieldnames.
> 
> 
>              John W. Vinson [MVP]
> 
> On Mon, 17 Dec 2007 13:38:31 -0800, jndickin
> < XXXX@XXXXX.COM > wrote:
> 
> >Access 2003
> >
> >I am trying to do a Select Query.  One of the Tables in the query has 
> >multiple listings for one Route# but only one of those is correct.  I'd like 
> >my query to only pull the first record for each Route#.  How can I modify my 
> >query to get that result?

3.Question about turning of "continue numbering" feature

Want to make "restart numbering" feature default instead 
of "continue numbering."  I hate having to right click or 
go to format everytime I make a new section of an 
outline.  Anyone know how?

4.StrConv question... (continued from an old post)

 	
Tom van Stiphout pointed out a syntaxn error that I
had made using StrConv on Mar 28. I was using
vbFromUnicode instead of vbUnicode. So, am OK
on that now.

Can someone help me understand what is being done
in the StrConv operation that turns this 19-character
string into a 38-char string:
?StrConv(" XXXX@XXXXX.COM ", vbUnicode)
M y A d d r @ M y D o m a i n . c o m 

Here are the ASCII codes for each of the 38 characters:
 77  0  121  0  65  0  100  0  100  0  114  0  64  0  77  0  121  0
68  0  111  0  109  0  97  0  105  0  110  0  46  0  99  0  111  0
109  0 
What purpose is served by inserting a Chr$(0) after each character?

5.Insertion Question Continue

This is not working. I was at firstgetting a method not found when I
used db.createrecordset, now when I use db.openrecordset I get a tye
mismatch. A couple questions: am I using this function properly for
what I am doing?  Also, do you see anywhere there might be a type
mismatch? I checked out all the data types in the tables and they are
all set to text. Except for NumOrdered. Any help out there? Thx.

-Chris


   ********Code Starts Here********
    Dim mysql As String
    Dim stModel As String
    Dim stVer As String
    Dim stCover As String
    Dim stStatus As String
    Dim intNum As Integer

    Dim db As Database
    Dim rs As Recordset

    Set db = CurrentDb
    Rem Set rs = db.createrecordset("SELECT NumOrdered, Model, Ver,
Cover from OrderedUpHolstery ", dbOpenDynaset)
    Set rs = db.OpenRecordset("OrderedUpholstery", dbOpenDynaset)
    rs.MoveFirst

    Do While Not rs.EOF

        stModel = rs!Model
        stVer = rs!Ver
        stCover = rs!Cover
        stStatus = rs!Status
        intNum = rs!NumOrdered

        For i = 1 To intNum
                mysql = "INSERT INTO InventoryUp (Model, Ver, Cover,
Status)  "
                mysql = mysql & "SELECT stModel, stVer, stCover,
stStatus;  "
                DoCmd.RunSQL mysql
        Next
        rs.MoveNext
    Loop
    
    
    Set db = Nothing
    Set rs = Nothing

6. Subquery Question - continued

7. Change backcolor of comboox in continue form

8. How to creat a Continue Search Form?



Return to MS Office Access

 

Who is online

Users browsing this forum: No registered users and 61 guest