473,657 Members | 3,022 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Forms - with Subforms based on a parameter Query, for whic Results can be edited.

hyperpau
184 Recognized Expert New Member
I've been going nuts about it and I've been searching all over the forums to find answers. Can somebody please help me?


I am a somehow advanced Access user with basic VBA knowledge.
(No ADO or SQL)

I have created this database for a Repair Center company to keep track of items that are received, transferred to a third party technicians, and released back to customers.

I created 3 Main tables with the following fields.
1) tblReceived
---ReceiveNo : Autonumber
---ReceiveDate : Date
---Description : Combobox (no need to specify source)
---SerialNo : Text
---Status : Combobox (no need to specify source)
---Technician : Combobox (no need to specify source)

2) tblTransferred
---TransferNo : Autonumber
---TransferDate : Date
---TransferItemsNo : ??? - Help Here
---Technician : Combobox (no need to specify source)
---Status : Combobox (no need to specify source)

3) tblReleased
---ReleaseNo : Autonumber
---ReleaseDate : Date
---ReleaseItemsNo : ??? - Help Here
---Status : Combobox (need to specify source)


Then I have 2 joining tables to connect the many-to-many relationships:

1) tblTransferItem s
---TransferItemsNo : Autonumber
---TransferNo : Links to tblTransfer
---ReceiveNo : Links to tblReceive

2) tblReleaseItems

---ReleaseItemsNo : Autonumber
---ReleaseNo : Links to tbl Release
---TransferNo : Links to tblTransfer


And here are my forms where I am having problems with.

1) frmReceive : source is qryReceive

2) frmTransfer : Source is tblTransfer
-----subfrmTransferI tems : Source is tblTransferItes m

3) frmRelease : Source is tblRelease
-----subfrmReleaseIt ems : Source is tblReleaseItems


4) frmSetTransfer ': unbound

5 frmSetRelease ) : unbound


What I want to happen is that user inputs information on tblTransfer which are
multiple items from the tblReceive.
And also input information on the tblRelease which are multiple items from the
tblTransfer:

Here is the Big Picture.

ReleaseNo1
-----TransferNo1
----------ReceiveNo1
----------ReceiveNo2
-----TransferNo2
-----------ReceiveNo3
-----------ReceiveNo4
ReleaseNo2
-----TransferNo3
------------ReceiveNo5
------------ReceiveNo6
-----TransferNo4
-----------ReceiveNo7
-----------ReceiveNo8


What I want is by using the unbound frmSetTransfer, items would appear
in the subfrmTransferI tems.
So I figure maybe the source for the subform
would be a parameter query based on the unbound form.

But I want it in a way that after the results are shown, users can see all
information (not only the first column) and edit them as well.
When a user selects a choice in the combobox Technician of frmTransfer,
all the Technician Field of subfrmTransferI tems will change
according to that as well.
The same goes to the Status Field of frmTransfer which should update
the Status field of all records on the subfrmTransferD etails.

I can't seem to find a way! Is my plan too complex?

Is it even possible to have tables and forms related in the way that I was planning it in the Big Picture above?
Jun 12 '07 #1
10 2093
FishVal
2,653 Recognized Expert Specialist
I've been going nuts about it and I've been searching all over the forums to find answers. Can somebody please help me?


I am a somehow advanced Access user with basic VBA knowledge.
(No ADO or SQL)

I have created this database for a Repair Center company to keep track of items that are received, transferred to a third party technicians, and released back to customers.

I created 3 Main tables with the following fields.
1) tblReceived
---ReceiveNo : Autonumber
---ReceiveDate : Date
---Description : Combobox (no need to specify source)
---SerialNo : Text
---Status : Combobox (no need to specify source)
---Technician : Combobox (no need to specify source)

2) tblTransferred
---TransferNo : Autonumber
---TransferDate : Date
---TransferItemsNo : ??? - Help Here
---Technician : Combobox (no need to specify source)
---Status : Combobox (no need to specify source)

3) tblReleased
---ReleaseNo : Autonumber
---ReleaseDate : Date
---ReleaseItemsNo : ??? - Help Here
---Status : Combobox (need to specify source)


Then I have 2 joining tables to connect the many-to-many relationships:

1) tblTransferItem s
---TransferItemsNo : Autonumber
---TransferNo : Links to tblTransfer
---ReceiveNo : Links to tblReceive

2) tblReleaseItems

---ReleaseItemsNo : Autonumber
---ReleaseNo : Links to tbl Release
---TransferNo : Links to tblTransfer


And here are my forms where I am having problems with.

1) frmReceive : source is qryReceive

2) frmTransfer : Source is tblTransfer
-----subfrmTransferI tems : Source is tblTransferItes m

3) frmRelease : Source is tblRelease
-----subfrmReleaseIt ems : Source is tblReleaseItems


4) frmSetTransfer ': unbound

5 frmSetRelease ) : unbound


What I want to happen is that user inputs information on tblTransfer which are
multiple items from the tblReceive.
And also input information on the tblRelease which are multiple items from the
tblTransfer:

Here is the Big Picture.

ReleaseNo1
-----TransferNo1
----------ReceiveNo1
----------ReceiveNo2
-----TransferNo2
-----------ReceiveNo3
-----------ReceiveNo4
ReleaseNo2
-----TransferNo3
------------ReceiveNo5
------------ReceiveNo6
-----TransferNo4
-----------ReceiveNo7
-----------ReceiveNo8


What I want is by using the unbound frmSetTransfer, items would appear
in the subfrmTransferI tems.
So I figure maybe the source for the subform
would be a parameter query based on the unbound form.

But I want it in a way that after the results are shown, users can see all
information (not only the first column) and edit them as well.
When a user selects a choice in the combobox Technician of frmTransfer,
all the Technician Field of subfrmTransferI tems will change
according to that as well.
The same goes to the Status Field of frmTransfer which should update
the Status field of all records on the subfrmTransferD etails.

I can't seem to find a way! Is my plan too complex?

Is it even possible to have tables and forms related in the way that I was planning it in the Big Picture above?
Hi!

As I've got it the things are going this way.

1. tblReceived.Rec eiveNo uniquely identifies single item
2. tblTransferred. TransferNo uniquely identifies single transfer of multiple items
3. tblReleased.Rel easeNo uniquely identifies single release of multiple items
4. Not all items of single transfer must be within single release.

If so the only thing you need is to add FK fields based on PK fields in tables tblTransferred and tblReleased to tblReceived.

1) tblReceived
---ReceiveNo : Autonumber
---ReceiveDate : Date
---Description : Combobox (no need to specify source)
---SerialNo : Text
---Status : Combobox (no need to specify source)
---Technician : Combobox (no need to specify source)
---TransferNo : Long, FK, lookup(tblTrans ferred)
---ReleaseNo : Long, FK, lookup(tblRelea sed)

2) tblTransferred
---TransferNo : Autonumber, PK
---TransferDate : Date
---TransferItemsNo : Remove this
---Technician : Combobox (no need to specify source)
---Status : Combobox (no need to specify source)

3) tblReleased
---ReleaseNo : Autonumber
---ReleaseDate : Date
---ReleaseItemsNo : Remove this
---Status : Combobox (need to specify source)

The rest tables are not needed, use joins.
Does this look like what you've been expected?
Jun 13 '07 #2
hyperpau
184 Recognized Expert New Member
Hi!

As I've got it the things are going this way.

1. tblReceived.Rec eiveNo uniquely identifies single item
2. tblTransferred. TransferNo uniquely identifies single transfer of multiple items
3. tblReleased.Rel easeNo uniquely identifies single release of multiple items
4. Not all items of single transfer must be within single release.

If so the only thing you need is to add FK fields based on PK fields in tables tblTransferred and tblReleased to tblReceived.

1) tblReceived
---ReceiveNo : Autonumber
---ReceiveDate : Date
---Description : Combobox (no need to specify source)
---SerialNo : Text
---Status : Combobox (no need to specify source)
---Technician : Combobox (no need to specify source)
---TransferNo : Long, FK, lookup(tblTrans ferred)
---ReleaseNo : Long, FK, lookup(tblRelea sed)

2) tblTransferred
---TransferNo : Autonumber, PK
---TransferDate : Date
---TransferItemsNo : Remove this
---Technician : Combobox (no need to specify source)
---Status : Combobox (no need to specify source)

3) tblReleased
---ReleaseNo : Autonumber
---ReleaseDate : Date
---ReleaseItemsNo : Remove this
---Status : Combobox (need to specify source)

The rest tables are not needed, use joins.
Does this look like what you've been expected?
Yes. Absolutely!!! I never though somebody would understand me
coz i had a hard time explaining my problem as well. Thanks.
You gave me more light to this.

just one more thing.
I already have an Autonumber field ( just didn't specify)
aside from the ReceiveNo, TransferNo, and ReleaseNo.
I've set this fields to Number (Long integer) and I want it
to increment everytime the form loads in add entry mode.

But it just doesn't increment at all.
The Format's for these fields are
ReceiveNo : "HPRec 07"00
TransferNo : "HPTra 07"00
Release No: "HPRel 07"00

and I have my forms coded like this:

Private Sub Form_Load( )

If Me.NewRecord Then
Me![ReceiveNo] = DMax([ReceiveNo], "tblReceive ") + 1
Else
Me![ReceiveNo] = Me![ReceiveNo]
End If

End Sub

But it just doesn't increment. every time the form is opened
at add entry mode, the fields just show as HPRec 0700, HPTra 0700, and HPRel 0700. It doesn't increment it. Is there something I've missed here?

Thanks in advance
Jun 14 '07 #3
FishVal
2,653 Recognized Expert Specialist
Yes. Absolutely!!! I never though somebody would understand me
coz i had a hard time explaining my problem as well. Thanks.
You gave me more light to this.

just one more thing.
I already have an Autonumber field ( just didn't specify)
aside from the ReceiveNo, TransferNo, and ReleaseNo.
I've set this fields to Number (Long integer) and I want it
to increment everytime the form loads in add entry mode.

But it just doesn't increment at all.
The Format's for these fields are
ReceiveNo : "HPRec 07"00
TransferNo : "HPTra 07"00
Release No: "HPRel 07"00

and I have my forms coded like this:

Private Sub Form_Load( )

If Me.NewRecord Then
Me![ReceiveNo] = DMax([ReceiveNo], "tblReceive ") + 1
Else
Me![ReceiveNo] = Me![ReceiveNo]
End If

End Sub

But it just doesn't increment. every time the form is opened
at add entry mode, the fields just show as HPRec 0700, HPTra 0700, and HPRel 0700. It doesn't increment it. Is there something I've missed here?

Thanks in advance
You don't have and moreover not able to write values to autonumber field.
Every time a new record is added Access will fill autonumber field with next number. You Me![ReceiveNo] is probably not linked to tblReceived.Rec eiveNo field, otherwise it will result in error (smthng like "field is read-only").

If you want ID's to appear with prefix via format property then you should do the following:

In form ;) design view.

Check that control format property is set to "HP... 07"00
And check that the control is linked to the source table autonumber field!

And get rid of the code above. It will never work with Autonumber fields.

Good luck.
Jun 14 '07 #4
hyperpau
184 Recognized Expert New Member
You don't have and moreover not able to write values to autonumber field.
Every time a new record is added Access will fill autonumber field with next number. You Me![ReceiveNo] is probably not linked to tblReceived.Rec eiveNo field, otherwise it will result in error (smthng like "field is read-only").

If you want ID's to appear with prefix via format property then you should do the following:

In form ;) design view.

Check that control format property is set to "HP... 07"00
And check that the control is linked to the source table autonumber field!

And get rid of the code above. It will never work with Autonumber fields.

Good luck.
Thank you for your continuous support.

Again, the ReceiveNo, TransferNo, and ReleaseNo are
not autonumber fields. I have another field for autonumber.
These are just number fields set to long integer.

ex:
tblReceive
-----ReceiveID <----autonumber; PK
-----ReceiveNo
-----Description
-----SerialNo
-----Status
-----OSP

I also tried what you suggested. I got rid of the other tables
and just added the lookup fields in the tblReceive.
It worked out so damn good. exept that, it only allows
me to input or receive new items in the frmTransfer.
What I want is that on the frmTransfer which is bound to tblTransfer,
I can just select items by a combo box bound to tblReceive.

With the scenario you taught me, I can only input new items, meaning
I will be receiving items using the Transfer form.

What I want is I receive Items using the frmReceive.

Then when I am about to transfer these items to outside technicians,
I would record the transfer using the frmTransfer and then selecting
the items to transfre instead of typing them all over again.

But the problem is, even if I am able to succesfully create the combobox
to select items to transfer, it just shows me one field.
I want to be able to see all fields of the item and edit them on the same
frmTransfer.

Did I say it clear enough? :)
Jun 14 '07 #5
FishVal
2,653 Recognized Expert Specialist
Thank you for your continuous support.

Again, the ReceiveNo, TransferNo, and ReleaseNo are
not autonumber fields. I have another field for autonumber.
These are just number fields set to long integer.

ex:
tblReceive
-----ReceiveID <----autonumber; PK
-----ReceiveNo
-----Description
-----SerialNo
-----Status
-----OSP

I also tried what you suggested. I got rid of the other tables
and just added the lookup fields in the tblReceive.
It worked out so damn good. exept that, it only allows
me to input or receive new items in the frmTransfer.
What I want is that on the frmTransfer which is bound to tblTransfer,
I can just select items by a combo box bound to tblReceive.

With the scenario you taught me, I can only input new items, meaning
I will be receiving items using the Transfer form.

What I want is I receive Items using the frmReceive.

Then when I am about to transfer these items to outside technicians,
I would record the transfer using the frmTransfer and then selecting
the items to transfre instead of typing them all over again.

But the problem is, even if I am able to succesfully create the combobox
to select items to transfer, it just shows me one field.
I want to be able to see all fields of the item and edit them on the same
frmTransfer.

Did I say it clear enough? :)

Once more Hi!

A previous version of tblReceive looked this way


I have created this database for a Repair Center company to keep track of items that are received, transferred to a third party technicians, and released back to customers.

I created 3 Main tables with the following fields.
1) tblReceived
---ReceiveNo : Autonumber
---ReceiveDate : Date
---Description : Combobox (no need to specify source)
---SerialNo : Text
---Status : Combobox (no need to specify source)
---Technician : Combobox (no need to specify source)

When did you release the new one? :)
I can only guess why do you need two Autonumber fields.
Well, in any case here is my suggestion.

Expand|Select|Wrap|Line Numbers
  1.  
  2. Private Sub Form_BeforeInsert(Cancel As Integer)
  3.     With Me
  4.         .RecordNo = DMax(.RecordNo.ControlSource, .RecordSource) + 1
  5.     End With
  6. End Sub
  7.  
  8.  
What concerns table structure.

With enough coding you can build friendly interface with both 3-table and 5-table schemas.


for ex. for transfers

With 3-table schema:

Transfer details and Listbox-to-Listbox interface on the main frmTransfer form and subformTransfer redItems subform (w/o additions allowed) with item details.

With 5-table schema:

Transfer details on the main frmTransfer form and subformTransfer redItems subform (additions allowed) with item details.
Subform source is

SELECT tblReceived.*, tblTransferredI tems.* FROM tblReceived INNER JOIN tblTransferredI tems ON tblReceived.Rec eivedID = tblTransferredI tems.ReceivedID ;

For the sake of suitability you can make multicolumn width combo associated with tblTransferredI tems.ReceivedID .
For the sake of suitability you should modify this combo RowSource property programmaticall y to prevent user from multiple addition of the same item and addition an item been released.
Additionally you should prevent multiple addition of the same item using table indices.

Helps?
Jun 14 '07 #6
FishVal
2,653 Recognized Expert Specialist
With 3-table schema:

Transfer details and Listbox-to-Listbox interface on the main frmTransfer form and subformTransfer redItems subform (w/o additions allowed) with item details.

With 5-table schema:

Transfer details on the main frmTransfer form and subformTransfer redItems subform (additions allowed) with item details.
Subform source is
3-table schema
frmReceived - item additions allowed
frmTransferred/subform - item additions allowed
frmReleased/subform - item addition not allowed

5-table schema
frmReceived - item additions allowed
frmTransferred/subform - item additions allowed
frmReleased/subform - item addition allowed
Jun 15 '07 #7
hyperpau
184 Recognized Expert New Member
3-table schema
frmReceived - item additions allowed
frmTransferred/subform - item additions allowed
frmReleased/subform - item addition not allowed

5-table schema
frmReceived - item additions allowed
frmTransferred/subform - item additions allowed
frmReleased/subform - item addition allowed

Thanks, I'll try this as soon as i get back to work, Monday.
Jun 15 '07 #8
hyperpau
184 Recognized Expert New Member
Thanks, I'll try this as soon as i get back to work, Monday.
You're the man FishVAl!!!!! your INNER JOIN statement actually worked so much!!!!

There's only one problem I have now.
I have a cancel button on the from with the subform for the Transfer.
But Everytime I click it, it does not undo the entries made in the subform. How do do it that it will undo the entry for both the form and subform?
Jun 20 '07 #9
FishVal
2,653 Recognized Expert Specialist
You're the man FishVAl!!!!! your INNER JOIN statement actually worked so much!!!!

There's only one problem I have now.
I have a cancel button on the from with the subform for the Transfer.
But Everytime I click it, it does not undo the entries made in the subform. How do do it that it will undo the entry for both the form and subform?
Hi!

Glad it was somewhat helpful.
What concerns Cancel button.
  • I would like to see code executed with the button click
  • I would like to know what relationship schema you've chosen at last, to avoid any misunderstandin g plz provide full metadata
Jun 21 '07 #10

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

Similar topics

3
3415
by: radioman | last post by:
Hi all, I would appreciate some help please. I just need pointing in the right direction as I am at a loss. Basically I have a form (frmAddMaster) which displays two subforms "Master Stock subform" and "Client Stock Template subform". Each subform contains the following fields "Product ID,Product Description and Size". What I am trying to do is to select rows from the "Master Stock subform" and copy them to "Client Stock Template...
19
4088
by: James Fortune | last post by:
I have a lot of respect for David Fenton and Allen Browne, but I don't understand why people who know how to write code to completely replace a front end do not write something that will automate the code that implements managing unbound controls on forms given the superior performance of unbound controls in a client/server environment. I can easily understand a newbie using bound controls or someone with a tight deadline. I guess I need...
4
1697
by: Luisa Lopes | last post by:
Dear colleagues: I read somewhere that you could obtain the results of a query as a form. I have design a database for my books and waht I would like is to obtain the results of my queries (which use parameters for language, author, genre, etc) in the form of a bunch of the original forms I used for creating the book entries. I don't know if I explained the problem correctly. As a result of a query I
8
3087
by: Zlatko Matiæ | last post by:
Hello. How can I synchronize subforms content with current record in master form, if both form and subform are based on DAO code ? I assigned DAO recordset to forms by using QueryDef, on Load event. Thanks...
3
1551
by: Marina | last post by:
Ok here's my problem.... I have a custom dialog box that allows the user to enter information to run a Parameter Query. This works GREAT, but I need that query to show as a form, not just the basic query screen. I have created the form, but how in the world do I get it to open based on the parameter query created by the user. Ugg... ok now even I'm confused... what a tangled web we weave... GRRRRR
1
2427
by: natwong | last post by:
Hi All, I'm hoping that someone could help me out since I'm new with Access. Background: Database was set up as a simple data entry and reporting tool for Program Initiatives. The data entry page has main form with 9 sections (1 main section and 8 subsections). These subsections are all employed using subforms. These are all joined through the ProgramID. The Report is set up in a similar fashion with main and subreports too. ...
8
36118
by: hoofbeats95 | last post by:
I don't think this should be this complicated, but I can't figure it out. I've worked with C# for several years now, but in a web environment, not with windows form. I have a form with a query button on it. If the query returns multiple results, a new window is opened with a grid containing the results. When the user double clicks on the desired row in the grid, I want the first form to populate with the correct data. I don't know how...
0
2377
by: TD | last post by:
I have a main form with two subforms (both in datasheet view), neither of which are linked to the main form. The main form is based on a query that uses the bound column of a combobox on the main form as the criteria for the query. The combobox is based on a query that retrieves the name and record id of the customers. In the afterUpdate event of the combobox on the main form and both subforms are requeried. The first subform is based...
1
1620
by: HSXWillH | last post by:
I have looked for some help on this and this article/thread was as close to what I was looking for as I could find. http://bytes.com/forum/thread603918-Null+Parameter+Query.html My only question is the end of the article talks about subforms and such and I don't think that's what I'm looking for exactly. My question is this: I have a query named Final_Results with the following fields: Position, E_Year, E_State, E_Type,...
0
8820
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8718
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8601
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7314
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5630
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
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 we have to send another system
2
1937
muto222
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.