Results 1 to 4 of 4

Thread: Update a Table

  1. #1
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Update a Table

    Hi Everyone,

    OK...this one is simple .... but not for me.

    I am currently emailing reports to specific people by the selection of a combo box, PM, as well tracking what report and when the report was printed using code in the OnOpen event of the report.

    i.e. if RN is selected in the combo box, PM, then Roberta Newton gets an email of the report and tTracker is updated.

    tTracker currently has 3 fields, 1)What Report, 2) Date Printed, and 3)Time Printed.

    My questions is, I want to add a field to tTracker named PM and have that field updated with the PM's initials that the report was sent to, in this case RN. How can I do this? One of the fields in the report is "PM" also.

    Thanks in advance.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  2. #2
    3 Star Lounger
    Join Date
    Jan 2001
    Location
    USA
    Posts
    386
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a Table

    With out knowing any more than is in the note.

    Add the field to the table. Then use the same code or query that currently updates the table and add the filed there as well. The draw back to this is that any current rows will not be updated with the PM field.

    Hope this helps.


    Richard Aheron
    raheron@hotmail.com
    Richard

  3. #3
    5 Star Lounger
    Join Date
    Feb 2001
    Location
    Louisville, Kentucky, USA
    Posts
    605
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a Table

    Thanks for the quick response.

    I guess I need to provide more information.

    Please see below:

    Public Function Open_Log(obj As Object)
    Dim db As Database
    Dim rsLog As Recordset

    Set db = CurrentDb()
    Set rsLog = db.OpenRecordset("tReportLog")
    With rsLog
    .AddNew
    .Fields("WhatReport") = obj.Name 'or whatever your field name is
    '.Fields("PM") = obj.Name
    .Update
    .Close
    End With
    Set rsLog = Nothing
    Set db = Nothing
    End Function

    As you can tell the code here will update tReport Log with specific information.

    The field "What Report" in tReportLog is updated with the name of the Report that printed.

    I am trying to find the correct code to update PM in tReportLog with the PM information that is in the report that printed.

    I know that obj.name will return the name of the report, but what do I need to put in the line of code to return the information in PM?

    Thanks for your help.
    Roberta Price <img src=/S/cheers.gif border=0 alt=cheers width=30 height=16>

  4. #4
    2 Star Lounger
    Join Date
    Jan 2001
    Location
    Winnipeg, Canada
    Posts
    109
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Update a Table

    Unless I misunderstand you, my question is why would you try to take the PM (initials)value "RN" from the report when you already have selected it in the combobox PM?

    Seems to me all you need to code is:

    .Fields("PM") = Me.PM (I think PM is the combobox name?)

    (Better call it cboPM, then we know what we're dealing with)
    <img src=/S/smile.gif border=0 width=15 height=15>

Posting Permissions

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