Add a Value to a field based on two matching variables (1 Viewer)

hornstar1964

New member
Local time
Today, 12:15
Joined
May 30, 2012
Messages
1
I have a database form with listboxes. One list box displays jobs that are being processed. Another listbox for jobs that have been processed and are in quality control. The third listbox lists completed jobs.

Also on the form I have an txtImageID textbox which is populated when clicking a record in any listbox. I have a subform that lists all imageID in my ImageIssue table. This table contains duplicate image ids.

The Processed listbox displays everything that doesnt have a date in the ProcessDoneDate feild from my ImageIssue table.

I have a command button on the form that I want it to do the following:

Onclick populate my subforms ProcessDoneDate with current date where txtImageID textbox = ImageID in my subform.

Since there are duplicate ImageID's in my subform I want to populate the current date for each ProcessDoneDate field where txtImageID from my parent form matches the ImageID in the subform.

When all is said and done upon clicking the command button my Processed list box will remove that issue and it will be moved to the Qaulity Control List box.


I know its wordy. The following code is what i have so far. It really doesnt work at all. Im not even sure if I am on the right track. It seems like it should be very simple but all of my research and trials havent panned out.

Here is my code:

Private Sub Command291_Click()

Dim DB As DAO.Database
Dim RS As Recordset
Dim icounter As Integer

icounter = 1

Set DB = CurrentDb
Set RS = DB.OpenRecordset("PhotoIssue")


RS.Index = "ImageID"
RS.Seek "=", Me.txtImageID

DoCmd.GoToRecord , , acFirst
Do While icounter < RS.RecordCount
If RS.NoMatch Then
DoCmd.GoToRecord , , acNext
icounter = icounter + 1
Else
Forms![frmImageResolution]![PhotoIssueSubForm]![ProcessDoneDate] = Date
Exit Do
End If
Loop

End Sub

Thanks in advance for any help.
 

Users who are viewing this thread

Top Bottom