locked
Form not saving record. RRS feed

  • Question

  • I have two forms that update a row of information. One form to 'start' the job, one to 'end' the job. In the start form's save button there is  a macro that says 'save record' then 'close window'.

    In the end form's save button there is a macro that goes like this:
    -save record

    -settempvar (ID,[...]![...]![ID:Text])

    -runsql (Update [...] SET CLOSED = -1 WHERE [ID] = [TEMPVARS]![ID])

    -removetempvar(ID)

    -closewindow

    I don't understand why the first form can edit the record while the second can't. 


    Start form populates columns 1 to 10 End form populates columns 11 to 12
    • Edited by UpTide Monday, June 17, 2013 6:27 PM
    Monday, June 17, 2013 6:24 PM

Answers

  • You say the second form can't save the record. Do you get an error message?  If so, what is it?

    What is the recordsource of the second form?  Is its AllowEdits property set to Yes?


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by UpTide Monday, June 17, 2013 7:38 PM
    Monday, June 17, 2013 6:52 PM

All replies

  • I don't understand why you need two forms to save a record.

    What exactly is your application doing? Could you post a sample, please?


    Vladimir Cvajniga

    Monday, June 17, 2013 6:34 PM
  • Table:

    Col1 then Col2 so on...

    ID(the pk) StartTime DispatcherS Reason DispatcherE EndTime Closed(-1,or 0)

    so example table:

    1 1:11 AA reasonhere AA 1:12 -1

    2 1:13 AA reasonhere BB 2:22 -1

    3 2:30 AA reasonhere NULL NULL 0

    start form assigns the ID and time, the user enters the two columns into the form and hits save. the DispatcherE and EndTime is NULL and closed is false because it is open...

    After the reason is done we want to use the second form to enter the end time (current time) and the person who ended it, then change Closed to true because it is done. We can not delete; we need the log.

    table at 1:11:30

    1 1:11 AA reasonhere NULL NULL 0

    table at 1:13:30

    1 1:11 AA reasonhere AA 1:12 -1

    2 1:13 AA reasonhere NULL NULL 0



    Also if someone could spell out how to change -1 to 0 without an update query just native to macro that would be a huge help.
    • Edited by UpTide Monday, June 17, 2013 6:49 PM
    Monday, June 17, 2013 6:42 PM
  • You say the second form can't save the record. Do you get an error message?  If so, what is it?

    What is the recordsource of the second form?  Is its AllowEdits property set to Yes?


    Dirk Goldgar, MS Access MVP
    Access tips: www.datagnostics.com/tips.html

    • Marked as answer by UpTide Monday, June 17, 2013 7:38 PM
    Monday, June 17, 2013 6:52 PM
  • Could you post a sample? Either VBA code or a sample app.

    Vladimir Cvajniga

    Monday, June 17, 2013 7:32 PM
  • sorry for slow reply, was busy.

    No error message, goes through like it works. Except, when I open the table view the closed dispatcher and closed time is null.

    Records source is the table, data entry is no, allow additions is yes allow edits is yes, record lock is no locks. (All same settings as first form)

    I would really like to avoid making my update query set all the entries.




    I'm so stupid I forgot to set the control source for the text boxes. Sorry for wasting everyone's time. Thank you all!
    • Edited by UpTide Monday, June 17, 2013 7:38 PM
    • Proposed as answer by Vladimir Cvajniga Monday, June 17, 2013 8:01 PM
    Monday, June 17, 2013 7:35 PM