Re: Auto populate a form from an open form
- From: "far-mer via AccessMonster.com" <u32423@uwe>
- Date: Tue, 13 Mar 2007 14:16:45 GMT
Al
Thanks for your help, I think I have cracked it. I have created an unbound
form that is called from the main page via a command button, it picks up the
ClientID in the process. When it is saved its uses the following code to
write the call information into the calls table:
Private Sub Command19_Click()
On Error GoTo Err_Command19_Click
Dim rstOrder As ADODB.Recordset
Set rstOrder = New ADODB.Recordset
rstOrder.Open "Calls", CurrentProject.Connection, adOpenStatic,
adLockOptimistic
If rstOrder.Supports(adAddNew) Then
With rstOrder
.AddNew
.Fields("Priority") = frmpriority
.Fields("Job Number") = frmjobnumber
.Fields("Date and time of call") = frmdatetime
.Fields("Comment") = frmcomment
.Fields("Staff taking call") = frmstafftakingcall
.Fields("Call for") = frmcallfor
.Update
Command22_Click
End With
End If
rstOrder.Close
Set rstOrder = Nothing
' DoCmd.Close
Exit_Command19_Click:
Exit Sub
Err_Command19_Click:
MsgBox Err.Description
Resume Exit_Command19_Click
End Sub
The call information is displayed on another form like an open call log, each
entry is colour coded based on the prority set from the call form. Each call
is displayed on a different line and alongside each entry is an "archive"
command button which should put a date in the call closed field of the calls
table - this is being done by an update query. However, when you click on it
it updates all of the records in the table not the one, I can't get it to
only update the record it is located on. For example the request I would
give is "update the record I am on with todays date and time". The call log
form is set to refresh every five minutes and to ignore any records that have
an archived date and time.
Hope this makes sense?
Thanks again for your help
Chris
Al Campagna wrote:
Farmer,
Please... don't delete the previous posts from the "thread." It's helpful to see the
"flow" of the problem determination. Just let the posts "chain."
Well, I'm losing you on this... I can not figure out what you're trying to accomplish,
that a normal Client Main form, and One to Many realtionship with a Calls subform won't
do. There also may be some "language" or "terminology" problems that are causing my
confusion.
You should (at least) get the application to work in the most basic manner... and
then... if you must... expirement with some more complicated solution.
I can only suggest how I would do it...
When a client calls, you find the correct client record (Main), and add a new record to
the Call (subform).
Because Client records (ClientID-Autonumber) are related (one to many/refrential
integrity/cascades) to Calls (ClientID-Long), and are linked on the form via Master/Child
fields...
whenever you add a new call record, the ClientID in Calls is automatically updated to the
related ClientID.
CallStart should have a Default Value of Now()... (which you can change if needed)
so... you just have fill in the "other" call info (Subject, CallEnd, etc..)
CallStart should be Indexed, but "Allow Duplicates" should be true. If not set that
way, you won't be able to enter 2 calls with the same CallStart.
You appear to say that when you create a new call record (say... 3/11/07 @ 9:00am),
something creates another record with that same date and time??
That must be something you coded in, and I can't respond to that without more detailed
information on your code.
Al[quoted text clipped - 15 lines]
Chris
--
Message posted via http://www.accessmonster.com
.
- References:
- Auto populate a form from an open form
- From: far-mer
- Re: Auto populate a form from an open form
- From: Al Campagna
- Re: Auto populate a form from an open form
- From: far-mer
- Re: Auto populate a form from an open form
- From: Al Campagna
- Re: Auto populate a form from an open form
- From: far-mer via AccessMonster.com
- Re: Auto populate a form from an open form
- From: Al Campagna
- Auto populate a form from an open form
- Prev by Date: The field 'MyTable.MyField' cannot contain a Null value because the Required property for this field is set to true.
- Next by Date: Re: use 1 combobox instead of 4
- Previous by thread: Re: Auto populate a form from an open form
- Next by thread: Re: Subforms Visable/Invisable
- Index(es):