PaddyIrishMan
Registered User.
- Local time
- Today, 01:28
- Joined
- Jun 5, 2002
- Messages
- 166
Hi all,
In my database, I have a field called "Comment". I'm displaying Continuous forms so I don't have a lot of space on screen. With this in mind & as the Comments field is optional I decided I would include it as a Popup - Double click a field & the following code runs:
'Build the SQL string
SQLString =
"SELECT tlb_CurrentTasks.Comment, tlb_CurrentTasks.[Record ID] FROM tlb_CurrentTasks
WHERE (((tlb_CurrentTasks.[Record ID]) = " & Me.Record_ID & "));"
'Open the Popup & set the RecordSource
DoCmd.OpenForm "frmComments", acNormal
Forms!frmComments.RecordSource = SQLString
So this *should* open the Comments form relating to the current record's record_id.
The problem I'm having is that it only works some of the time.
Sometimes it gets the record_id wrong.
The Record_id is an autonumber field & sometimes what happens is that the comments field pops up BUT the comment is entered into an incorrect record - i.e. If I add a comment to the first record while no other records exist, a new record is created in the background (next increment of the autonumber field) & this is where the comment is added.
I'm not sure if I've made much sense above but maybe if you've seen similar issues & if you could offer any suggestions they'd be much appreciated.
Regards,
Patrick
In my database, I have a field called "Comment". I'm displaying Continuous forms so I don't have a lot of space on screen. With this in mind & as the Comments field is optional I decided I would include it as a Popup - Double click a field & the following code runs:
'Build the SQL string
SQLString =
"SELECT tlb_CurrentTasks.Comment, tlb_CurrentTasks.[Record ID] FROM tlb_CurrentTasks
WHERE (((tlb_CurrentTasks.[Record ID]) = " & Me.Record_ID & "));"
'Open the Popup & set the RecordSource
DoCmd.OpenForm "frmComments", acNormal
Forms!frmComments.RecordSource = SQLString
So this *should* open the Comments form relating to the current record's record_id.
The problem I'm having is that it only works some of the time.
Sometimes it gets the record_id wrong.
The Record_id is an autonumber field & sometimes what happens is that the comments field pops up BUT the comment is entered into an incorrect record - i.e. If I add a comment to the first record while no other records exist, a new record is created in the background (next increment of the autonumber field) & this is where the comment is added.
I'm not sure if I've made much sense above but maybe if you've seen similar issues & if you could offer any suggestions they'd be much appreciated.
Regards,
Patrick