Save Record in Form.

ipaqAccess

Registered User.
Local time
Today, 12:45
Joined
Jun 13, 2011
Messages
11
Hi,

I've been searching but could not find a way to solve this.
I have a Form with List box that list the items and several text boxes that display info of the selected items in that list box.

So I use the Dlookup in the list box so that the text boxes will auto update the info regard to the selected item in the list box.

My issues is I want to change the info in those text boxes and auto save the record.
I tried many ways but didnt work.
I tried to use Macro SaveRecord for Save button, after update, after change focus
Tried If Me.Dirty Then Me.Dirty = False
DoCmd.RunCommand acCmdSaveRecord

Please help to advise where did I do wrong? My guess is that because of the Dlookup that prevent the save but if I dont use the Dlookup then what should I use.
Thanks much in advanced
 
I don't think you will be able to edit your record the way you are trying. What I would suggest is that you open the currently selected record in a Pop Up form and do your edits there, then requery your listbox once you are done. The following code should do the trick;
Code:
    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "FormNameToEditDetails"
    
    stLinkCriteria = "[YourRecordID]=" & Me![YourListBox]    [COLOR="DarkGreen"]'The first column of the lust box [B]MUST[/B] contain [B][I]YourRecordID[/I][/B][/COLOR]
    DoCmd.OpenForm stDocName, , , stLinkCriteria, ,acDialog
    Me.ListBoxName.Requery
 

Users who are viewing this thread

Back
Top Bottom