473,471 Members | 1,716 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Auto populating problem

21 New Member
Hi,

I am having a really difficult time with this, so any help is very much appreciated. I have created a form with two subforms. The parent form includes patient data. The first subform contains appointment data. The second subform contains delivery data. The three tables are linked by member record number. I have two problems that I have been trying to figure out for weeks!

The first is that I want the two subforms to populate with the data based on the member record number that is typed in...unless it is the first time data is entered for that patient. It was working just fine, but then I deleted the relationships so that I could rename the member record number field. After I reestablished the relationships, this feature no longer worked. I have no idea what happened!

The second thing that I am trying to do is to enter the member record number and have the remaining patient information populate, such as first name, last name, etc. Currently, when I update the member record number field, nothing happens. The medical record number is text. Here's the VB code.

Private Sub Medical_Record_Number_AfterUpdate()
Dim rst As DAO.Recordset

Set rst = Me.RecordsetClone

rst.FindFirst "[Medical Record Number] = '" & [Medical Record Number] & "'"

If rst.NoMatch = False Then
Me.Undo
Me.Bookmark = rst.Bookmark
MsgBox "Medical Record Number already exists!"
End If
End Sub

Anyone know what I am doing wrong?

Thanks for your help!

Linda
Oct 30 '07 #1
5 1992
nico5038
3,080 Recognized Expert Specialist
I assume you did delete the relation ship in the relationship window.
A subform has two linkage fields (single click the subform in design mode and open the Data tab in the properties window) and these should reflect the proper fieldnames for the Main and Subform field that defines the relationship.

To find a member record number, just add a combobox and select the option for a "Search" combo. Access will provide the needed code for the find, but make sure that the field is NOT bound to a tablefield.

Nic;o)
Oct 31 '07 #2
lindabaldwin
21 New Member
I assume you did delete the relation ship in the relationship window.
A subform has two linkage fields (single click the subform in design mode and open the Data tab in the properties window) and these should reflect the proper fieldnames for the Main and Subform field that defines the relationship.

To find a member record number, just add a combobox and select the option for a "Search" combo. Access will provide the needed code for the find, but make sure that the field is NOT bound to a tablefield.

Nic;o)

Hi Nic,

I did delete the relationships in order to change some things on the table, but I re-established the relationships. I tried what you recommended above, but I am not sure what the two linkage fields are. I clicked on the subform then the data tab and I only see the following fields: Record Source, Filter, Order By, Allow Filters, Allow Edits, Allow Deletions, Allow Additions, Data Entry, Recordset Type, Record locks, Fetch Defaults.

Also, although the combo box is useful in finding a member record number, I am not sure how to use that information to auto populate the other fields, such as, first name, middle initial, last name, physician, etc. I managed to auto populate the fields using DLookup using an AfterUpdate sub, but I am encountering some difficulties with that still. It does not auto populate the desired fields until after I click on a subform. Then it will not allow me to save changes to it because it says it would cause duplicate information on the primary key. I am really not sure what I am doing wrong. Any ideas?

I don't understand why you would not want the field bound to a table field. Would you explain that a little more?


Thanks.

Linda
Nov 1 '07 #3
nico5038
3,080 Recognized Expert Specialist
Hi Nic,

I did delete the relationships in order to change some things on the table, but I re-established the relationships. I tried what you recommended above, but I am not sure what the two linkage fields are. I clicked on the subform then the data tab and I only see the following fields: Record Source, Filter, Order By, Allow Filters, Allow Edits, Allow Deletions, Allow Additions, Data Entry, Recordset Type, Record locks, Fetch Defaults.

Also, although the combo box is useful in finding a member record number, I am not sure how to use that information to auto populate the other fields, such as, first name, middle initial, last name, physician, etc. I managed to auto populate the fields using DLookup using an AfterUpdate sub, but I am encountering some difficulties with that still. It does not auto populate the desired fields until after I click on a subform. Then it will not allow me to save changes to it because it says it would cause duplicate information on the primary key. I am really not sure what I am doing wrong. Any ideas?

I don't understand why you would not want the field bound to a table field. Would you explain that a little more?


Thanks.

Linda

You'll have to single-click the subform when you have the mainform in editmode.
The Linkage fields aren't visible when you double-click the subform as that will give the form properties of the subform.

When you need e.g. a customers address on an orderform you can add a CustomersSubform and link that with the linkage fields to the combobox so the correctaddress is displayed when you change the combo information.

Just give it a try.

Nic;o)
Nov 1 '07 #4
lindabaldwin
21 New Member
You'll have to single-click the subform when you have the mainform in editmode.
The Linkage fields aren't visible when you double-click the subform as that will give the form properties of the subform.

When you need e.g. a customers address on an orderform you can add a CustomersSubform and link that with the linkage fields to the combobox so the correctaddress is displayed when you change the combo information.

Just give it a try.

Nic;o)
Hi Nic,

Thank you for your assistance. I was able to view the linkage. It appears to be correct, but when I enter the linked information on the parent form (medical record number), it does not pull up the related data on the subforms. It just stares blankly at me like it doesn't know what I want it to do.

I have a question about the usage of the combo box. Is this strategy similar to a lookup table? I am not sure how the combo box method would work for me. The combox limits me to the records I already have in the table. It will not let me enter in new data. Am I doing this right?

Thanks.

Linda
Nov 1 '07 #5
nico5038
3,080 Recognized Expert Specialist
When nothing is made visible, the keyfields are probably incorrect.
I see spaces in your fieldname, this requires brackets [ and ] around it like:
[medical record number]

For the combobox you'll need to check the "NotInList" event that will allow the addition of new values. Check this description to learn all about it:
http://www.fontstuff.com/access/acctut20.htm

Basically you can have different working comboboxes, one to limit the values, one to expand the values and one for searching a record. You'll see that the Combobox wizard shows the possibilities when started for a new combobox.

Nic;o)
Nov 1 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: David Shorthouse | last post by:
HI is it posible to auto populate an access database.? I have 1 table structured Index_ID. - Index & auto number First_Name - Char50 Surname - Char50 Initals - Char50 Postcode - Char50...
7
by: Yannick Turgeon | last post by:
Hello all, I'm using SS2K on W2k. I'v got a table say, humm, "Orders" with two fields in the PK: OrderDate and CustomerID. I would like to add an "ID" column which would be auto-increment...
3
by: sao | last post by:
I am currently using Access 2000. In my table it is the following fields that are set up: 1 - Staff Name 2 - Department This table is already populated with 100+ records (staff along with...
1
by: Jason Galvin | last post by:
I would like to disable the auto-populating feature (remembers form element text between post-backs) when creating a .NET form. I have succeeded in disabling auto-populate by creating my controls...
1
by: Thumper | last post by:
I have created a "Services" table in Access. Within this table I have a "Services Provided" combo box that lists various services I have populated in a "Products" table. I also have a "Default...
4
by: JayV | last post by:
I've created a data entry form. I have multiple fields but the fields "Road Log #" and "Road Name" I want to be bound to each other. I also have a table that lists out 1200 road log numbers and their...
2
by: kkramer | last post by:
I have a table in Access which is auto populating fields which I do not want to happen. If I list a number in a field, and then another number in the field below it, and then a third number, if...
3
by: Wayne L | last post by:
Ok now everyone has mentioned not to use auto number if it means anything to the user. My application uses the auto number for exporting only. I append the mastertbl column with my starting number of...
3
by: Puzzled and Confused | last post by:
It seems like a simple request, but I cannot get it to work. Does anyone know to how to make data from one field auto populate in another field, only if the answer is yes/true? I have a form that I...
4
by: olidenia | last post by:
I need some help or tips on the following. I have a .sql database file with the folowing structure: DROP TABLE IF EXISTS `car`; CREATE TABLE IF NOT EXISTS `car` ( `id` int(10) default...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.