All,
I have a Main Form where the user enters a value in a Textbox and then hits a Button to return the data.
I have recently found out that there may be 2 or more records with the same Value in that field.
So now I have introduced a method to open a Form with any examples where there are more than 1 record, as follows:
This opens up the new Form:
The design is:
Control Source = qry_DC:Main
Continuous Forms
Header = Lables
Detail = Textboxes with values
No Additions
How can I modify the above so the user selects the record required which inturn populates the Main Form with the correct record.
I was thinking of adding a simple Checkbox but I don't know how to add one for each record in the set.
I realise I will doubtless need to provide more info, but that's my starter for 10.
Cheers,
I have a Main Form where the user enters a value in a Textbox and then hits a Button to return the data.
I have recently found out that there may be 2 or more records with the same Value in that field.
So now I have introduced a method to open a Form with any examples where there are more than 1 record, as follows:
Code:
Private Sub cmb_SearchRec_Click()
Dim dbs As Database, rst As Recordset
Set dbs = CurrentDb
SetNINOval (Me!NinoCrn.Value)
Set rst = dbs.OpenRecordset("qry_DC:Main")
'Application.Echo False
If rst.RecordCount = 0 Then
If NINOval = "" Then
Me!NinoCrn.SetFocus
Exit Sub
Else
MsgBox "The NINO you have enter does not exist on the System," & _
Chr(13) & Chr(10) & "please re-enter the NINO again", vbCritical + vbOKOnly, "Error"
Me!NinoCrn.Value = ""
Me!NinoCrn.Requery
Me!NinoCrn.SetFocus
Exit Sub
End If
Else
rst.MoveLast
If rst.RecordCount > 1 Then
MsgBox "There are " & rst.RecordCount & " records with this NINO", vbOKOnly, "Choose Record"
DoCmd.OpenForm "frm_MultiRecords"
Exit Sub
End If
Me.Requery........................etc. If only one record.
This opens up the new Form:
The design is:
Control Source = qry_DC:Main
Continuous Forms
Header = Lables
Detail = Textboxes with values
No Additions
How can I modify the above so the user selects the record required which inturn populates the Main Form with the correct record.
I was thinking of adding a simple Checkbox but I don't know how to add one for each record in the set.
I realise I will doubtless need to provide more info, but that's my starter for 10.
Cheers,