Automatically moving data into form fields from another table (1 Viewer)

lyatri

Registered User.
Local time
Yesterday, 17:35
Joined
Dec 6, 2012
Messages
14
Hi All
I have a list of clients in a seperate table they have an auto number assigned which is the primary key and they are also assigned to differant practices. Three pieces of info in total.

In my main table the list of clients is used to populate a combobox/drop down menu. On the form for that table I would like it to automatically display the practice and the number when you select the client i.e. pull all the info through from the other table. Is this possible

Thanks in advance
 

lyatri

Registered User.
Local time
Yesterday, 17:35
Joined
Dec 6, 2012
Messages
14
Hi
Thankyou very much for your guide. I have one field which I want to also fill into the table (second part of your guide) I am having an issue as I already have an event procedure in after update for the combobox to make it carry forward to the next record. How do I get it to do both procedures
Thanks in advance
 

lyatri

Registered User.
Local time
Yesterday, 17:35
Joined
Dec 6, 2012
Messages
14
Hi
I have fixed the above problem by adding code to VB for auto updating next record.

I am no however having a slightly different problem. There are 3 fields which I want to auto update on new records until changed. These are client name, address and client ID. Client name is changed using a combo box then address is auto brought through as is client ID (this field is saved in main database along with client name). The address and name work fine but the client ID number doesn't do it unless the client name is reselected from combo box.
Thanks
 

mbhw99

Registered User.
Local time
Yesterday, 19:35
Joined
Apr 3, 2012
Messages
55
pbaldy, this is exactly what I'm looking for, but if you could please give me some direction for a compile error for the code:

My combo is "Name" and my text box is "EID". When I debug the code, I get an "invalid qualifier" with .Name highlighted.

Code:
Private Sub Name_AfterUpdate()
Me.EID = Me.Name.Column(1)
End Sub
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:35
Joined
Aug 30, 2003
Messages
36,140
Name is a reserved word, and shouldn't be used as an object name. In this case, Me.Name would return the name of the form. I'd change the name of the combo, but bracketing it may work.
 

mbhw99

Registered User.
Local time
Yesterday, 19:35
Joined
Apr 3, 2012
Messages
55
That took care of that. Now when I try to choose an option in the combo, I get a pop-up error:
Microsoft Visual Basic said:
Run-time error '438':

Object doesn't support this property or method

and the whole line of code is highlighted:
Code:
Me.EID = Me.[Employee Name].Column(1)
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:35
Joined
Aug 30, 2003
Messages
36,140
Can you post the db here?
 

mbhw99

Registered User.
Local time
Yesterday, 19:35
Joined
Apr 3, 2012
Messages
55
It's still a work in progress...
 
Last edited:

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:35
Joined
Aug 30, 2003
Messages
36,140
You didn't change the name of the combo. I changed it to cboName and this code works:

Code:
Private Sub cboName_AfterUpdate()
  Me.EID = Me.cboName.Column(1)
End Sub
 

mbhw99

Registered User.
Local time
Yesterday, 19:35
Joined
Apr 3, 2012
Messages
55
And it's a beautiful thing. I had a feeling I forgot something...figures it would be so simple lol.
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:35
Joined
Aug 30, 2003
Messages
36,140
It's usually the simple things that trip us up.
 

eroyjenkins

New member
Local time
Yesterday, 19:35
Joined
Jan 15, 2013
Messages
5
pbaldy. I'm doing the same thing in a Web form and I get an error when I use your method of including field from the combo. "The expression you entered is not valid with Web-compatible forms." Any ideas?
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:35
Joined
Aug 30, 2003
Messages
36,140
I haven't used a web form yet but I know you can't use VBA in them. You'd need to use a macro. The action is either SetValue or SetProperty, I can't remember which offhand.
 

eroyjenkins

New member
Local time
Yesterday, 19:35
Joined
Jan 15, 2013
Messages
5
It appears to be SetProperty but now I can't get it to complete the field from the drop list fields. The property I'm setting is Value but the Value field will not work. What would be the syntax for the value field?
 

eroyjenkins

New member
Local time
Yesterday, 19:35
Joined
Jan 15, 2013
Messages
5
I'm setting the value of the Title_Subject field on the form to the same field in the drop list values from the same table, tblReferenceReferences.

When run, the Macro says that the object doesn't contain the Automation object "tblReferenceReferences."
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 17:35
Joined
Aug 30, 2003
Messages
36,140
You would copy it from the appropriate column of the combo, not the table directly.
 

eroyjenkins

New member
Local time
Yesterday, 19:35
Joined
Jan 15, 2013
Messages
5
I have a Standards form with a Criteria subform for many criteria for each Accreditation Standard. The Criteria subform has a subform for the guidelines for each Criteria. The Guidelines subform has subforms for Applicabillity, Required Documents, Training Type, Event Types, and References. Each of these guideline subforms create a join table for the many to many relationships. The References subform is giving me fits.

I had it working and apparently broke it when fixing something else.

I have a drop list for choosing from the (master) References Table a listed reference by the Number-Type field. I want the next field to be unique for each join. It allows the specific location within the reference such as chapter or paragraph numbers (text field). These are both working.

What I want the next field to be is one of the fields from the (master) References table I included in the drop list, the Title-Subject field (automatically when the drop record is selected) and the same thing for the last field, the Dated field.

I have tried to set a Macro on the drop list field to populate the Title-Subject field with no luck. I'm using the SetProperty action for the Title_Subject Control to set the Value to =[Title-Subject]. What is the correct syntax or how can this be done?
 

Users who are viewing this thread

Top Bottom