Hardcoded Autofill

Tubbzuk

Registered User.
Local time
Today, 01:41
Joined
Dec 21, 2012
Messages
37
Hi,

I have been writing a database which is near completion.
I have a sample entry form. In this form a product code needs to be entered.
I have a list of products in a table with descriptions.
The samples are stored in a different table.
What i want to do is when the user enters a product code, the description box automatically fills with the correct description.
The problem i have is that when the user adds that record to the database, the description field is empty.

I understand this would not follow normalization rules but i am a complete novice and need that data to all be in the one section.

Regards,

Alan
 
Worked a treat. Brilliant. Thank you ;-)
 
I have made an Autofill which is working.
Contacts & Tasks tables. In the Tasks details form Contact name is obtained from the Contacts tbl. Names and contact info is displayed.
It works well when all of the contacts fields are filled and if a contact is selected in the tasks details form.

Two problems.

1. The form does not always need to use the Contact AutoFill but the form does not let us continue unless the autofill field is used. Sometimes that field needs to be left blank.
I am sure it is something like if null=.... not sure where to put that or what to say after null

2. If the Contact fields I am bringing in [just to view] are not filled in the primary table we get an error.
I believe the answer is similar to #1 If null.... but again I am sorry to say I don't know where to put the if statement and what to say afterwards.

Thank you in advance for your help and thoughts.

Lianne
 
The first thing I'd check is the field in the table isn't required.
 
Thanks for the quick reply. Yes I ensured that the field in the table isn't required.
Everything works if a contact person is selected and if all the fields are filled in for that contact person [contacts tbl].

When I try to save a new task without including a contact name the following error appears.
"The Microsoft Accesss database engine cannot find a record in the table 'Contacts' with key matching field(s) 'ContactID'."

The following is the Event Procedure code In the Task Details form, I have the following code in the "On Change" for ContatName
I believe I need to add code that says if ContactName is blank - continue anyway. Maybe add code in the "On Exit"? or in here?

Private Sub cboContact_Change()
Me.txtOrganization.Value = Me.cboContact.Column(3)
Me.txtRole.Value = Me.cboContact.Column(4)
Me.txtPhone.Value = Me.cboContact.Column(7)
Me.txtCell.Value = Me.cboContact.Column(6)
Me.txtEmailAddress.Value = Me.cboContact.Column(5)


End Sub
 
The change event fires with every keystroke. I'd use the after update event, which will only fire when the user is done.
 
Oh, that message is probably from referential integrity being set up in the relationships window.
 

Users who are viewing this thread

Back
Top Bottom