Thanks for the detail, Some of it I am still unsure of, but the table
structure and some of your work flow I get now. Probably I don't need to
understand it if I can help you figure out what to do...
Think I have the query working with the quoteid table and the ticketentry
table. I am able to go to quoteid dropdown and select it and it fills in the
given fields on the ticket entry table. One glitch is it puts in the
Clientid from the quotetable but I need reselect it for the ticketentry table
since it is one of the primary keys. Any way not to have to reselect the
clientid??
Are you not quoting a customer, and then using the the quote for that
customer, for that customers new invoice? How would the clientID be
different?
You could just not include the ClientID in the fields that are brought in by
the quote. The ClientID in the invoice form would always be selected prior
to using the list of quotes.
The error I get is the following :
The current field must match the join key '?' in the table that serves as
the one side of one to many relationship. Enter a record in the 'one' side
table with the desired key value, and the make then make the entry with the
desired join key in the 'many' only' table.
One to many join, data needs to support the join. In other words the value
must exist in the one side before it can exist in the many side. Your record
is being saved by the auto fill process before this has happened.
The only relationships that exist that you have told me about where the
Invoice is on the many side are the ClientID and the quoteID fields. Which
means that you have entered a quotID that doesn't exist in the Quote table or
a ClientID that doesn't exist in the Client table. Neither of those make
sense but maybe this will help. Maybe put something like this in the
OnCurrent event code so you can test when it is being run to help you figure
it out ...
MsgBox "On current event ha+-ppened"
Maybe you have the composite key of ClientID and ticket# defined in a
relationship and the autofill function is saving your record before the
clientID field is filled with the ClientID?
[Autofillnewrecords] is a text box Unbound on the form – not visible the
default value for the text box is listed below
"cbojob;ServiceDate;cost;Pit;Comments;GrossWeight;Truck;cboemplcode;TruckHours;CartageRate" These are the fields we want same as previous record.
An event procedure for the On Current of the Form
Private Sub Form_Current()
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![2TicketEntryForm])
End Sub
Maybe change this to ...
Private Sub Form_Current()
If IsNull(Me.controlcboJob) then
Me![Recordnumber] = Me.CurrentRecord
Call AutoFillNewRecord([Forms]![2TicketEntryForm])
End If
End Sub
That way it is conditional that when the OnCurrent event triggers the code
only runs the first time the record is created. When you add from the quote
nothing will happen and you be able to edit the values without the autfill
being triggered in the future. Or create a field called newrecord that is
yes/no - defaults to yes, your caode changes it to no the first time autofill
runs and then thereafter does not run autofill if the value of newrecord is
no.
There is a field called recordnumber
I would like it to autofill info from previous record and then allow for the
user to select a quoteid if applicable and have it fill in those given fields
if the quoteid is selected. I think it is getting confused.
Thanks so much,
Barb
Hope this helps you figure it out.
Roger