passing data to new form using open args

F

fsuds

I posted this in the forms forum but have yet to receive a response. I
figured maybe I could try this one. Thanks for any help.

----------------------------------------------------

I'm having trouble figuring out what I need to do here. Basically, I
want to pull data from several different tables and send them to a form
using open args. However, the form that is being fed need to have
certain columns of data concatenated and displayed in combo boxes. The text
boxes receive and display the correct data but my combo boxes remain blank.

Here is the code from my search form to feed the rental edit:

sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]," & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID],"
& _
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTAL.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM, RENTAL, EVENT" & _
" WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"


DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL

Here is the code for my 2 combo boxes on the edit form:

frmEditRental


cmbEVENT: SELECT ([RENTAL].[EventID]) & ", " & nz([EVENT].[Name]) & ",
" & nz([EVENT].[FILENUMBER]) AS Expr1
FROM EVENT INNER JOIN RENTAL ON [EVENT].[EVENTID]=[RENTAL].[EventID];


cmbPrice: SELECT [RENTALITEM].[RentalID], ([RENTAL.RENTALITEM]) & ", "
& ([RENTAL].[RENTALTYPE]) & ", " & ([RENTAL].[PRICEPERUNIT]) AS Expr1
FROM RENTAL INNER JOIN RENTALITEM ON
[RENTAL].[RentalID]=[RENTALITEM].[RentalID];


txtRentalDate: RentalDate
txtRID: RID
txtQuantity: Quantity


I also have a similar form setup for data entry and can select data through
the combo box but when I save the record, not all of the information is saved
in the table.

I'm absolutley stuck. All help is greatly appreciated.
 
K

Klatuu

The first problem you are having is how you are using the OpenArgs argument.
The form receiving the OpenARgs does nothing with it unless you code for it.
That is usually done in the Form's Open event. See VBA Help for good info on
how you use it.

If the SQL you are trying to send to the form is the data you want for your
form, then you should make that the Record Source for the form. And, if you
are trying to filter what data is presented in the form. Then the usual
method is to construct a WHERE Clause without the word Where and use that in
the OpenForm method as the Where argument. Again, look in VBA Help for info
on OpenForm.

As to the SQL you have for your combo boxes. Take out the commas. Set your
Row Source type to Table/Query and put the SQL in the Row Source property.
You will have to make some adjustments to your combos to set the correct
number of columns, the bound column, and the column width properties.

Once you get this much going, post back with what is and is not working so
we can take it from there.
fsuds said:
I posted this in the forms forum but have yet to receive a response. I
figured maybe I could try this one. Thanks for any help.

----------------------------------------------------

I'm having trouble figuring out what I need to do here. Basically, I
want to pull data from several different tables and send them to a form
using open args. However, the form that is being fed need to have
certain columns of data concatenated and displayed in combo boxes. The text
boxes receive and display the correct data but my combo boxes remain blank.

Here is the code from my search form to feed the rental edit:

sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]," & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID],"
& _
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTAL.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM, RENTAL, EVENT" & _
" WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"


DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL

Here is the code for my 2 combo boxes on the edit form:

frmEditRental


cmbEVENT: SELECT ([RENTAL].[EventID]) & ", " & nz([EVENT].[Name]) & ",
" & nz([EVENT].[FILENUMBER]) AS Expr1
FROM EVENT INNER JOIN RENTAL ON [EVENT].[EVENTID]=[RENTAL].[EventID];


cmbPrice: SELECT [RENTALITEM].[RentalID], ([RENTAL.RENTALITEM]) & ", "
& ([RENTAL].[RENTALTYPE]) & ", " & ([RENTAL].[PRICEPERUNIT]) AS Expr1
FROM RENTAL INNER JOIN RENTALITEM ON
[RENTAL].[RentalID]=[RENTALITEM].[RentalID];


txtRentalDate: RentalDate
txtRID: RID
txtQuantity: Quantity


I also have a similar form setup for data entry and can select data through
the combo box but when I save the record, not all of the information is saved
in the table.

I'm absolutley stuck. All help is greatly appreciated.
 
F

fsuds

Sorry, guess I should have also put the Forms OnLoad Event

Me.RecordSource = Me.OpenArgs

One question. If I put my SQL into the row source property, that will pull
the data but will only display the bound column when a record is selected,
correct? I know that this sounds crazy but I was hoping to display all of
the information in the combo.

Thanks for the response and help so far.

Klatuu said:
The first problem you are having is how you are using the OpenArgs argument.
The form receiving the OpenARgs does nothing with it unless you code for it.
That is usually done in the Form's Open event. See VBA Help for good info on
how you use it.

If the SQL you are trying to send to the form is the data you want for your
form, then you should make that the Record Source for the form. And, if you
are trying to filter what data is presented in the form. Then the usual
method is to construct a WHERE Clause without the word Where and use that in
the OpenForm method as the Where argument. Again, look in VBA Help for info
on OpenForm.

As to the SQL you have for your combo boxes. Take out the commas. Set your
Row Source type to Table/Query and put the SQL in the Row Source property.
You will have to make some adjustments to your combos to set the correct
number of columns, the bound column, and the column width properties.

Once you get this much going, post back with what is and is not working so
we can take it from there.
fsuds said:
I posted this in the forms forum but have yet to receive a response. I
figured maybe I could try this one. Thanks for any help.

----------------------------------------------------

I'm having trouble figuring out what I need to do here. Basically, I
want to pull data from several different tables and send them to a form
using open args. However, the form that is being fed need to have
certain columns of data concatenated and displayed in combo boxes. The text
boxes receive and display the correct data but my combo boxes remain blank.

Here is the code from my search form to feed the rental edit:

sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]," & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID],"
& _
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTAL.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM, RENTAL, EVENT" & _
" WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"


DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL

Here is the code for my 2 combo boxes on the edit form:

frmEditRental


cmbEVENT: SELECT ([RENTAL].[EventID]) & ", " & nz([EVENT].[Name]) & ",
" & nz([EVENT].[FILENUMBER]) AS Expr1
FROM EVENT INNER JOIN RENTAL ON [EVENT].[EVENTID]=[RENTAL].[EventID];


cmbPrice: SELECT [RENTALITEM].[RentalID], ([RENTAL.RENTALITEM]) & ", "
& ([RENTAL].[RENTALTYPE]) & ", " & ([RENTAL].[PRICEPERUNIT]) AS Expr1
FROM RENTAL INNER JOIN RENTALITEM ON
[RENTAL].[RentalID]=[RENTALITEM].[RentalID];


txtRentalDate: RentalDate
txtRID: RID
txtQuantity: Quantity


I also have a similar form setup for data entry and can select data through
the combo box but when I save the record, not all of the information is saved
in the table.

I'm absolutley stuck. All help is greatly appreciated.
 
K

Klatuu

You want the entire record in the combo? why?
A record is always selected. When you open a form, the first record in the
form's recordset is always displayed.

I guess I don't understand what it is you are actually trying to do.

fsuds said:
Sorry, guess I should have also put the Forms OnLoad Event

Me.RecordSource = Me.OpenArgs

One question. If I put my SQL into the row source property, that will pull
the data but will only display the bound column when a record is selected,
correct? I know that this sounds crazy but I was hoping to display all of
the information in the combo.

Thanks for the response and help so far.

Klatuu said:
The first problem you are having is how you are using the OpenArgs argument.
The form receiving the OpenARgs does nothing with it unless you code for it.
That is usually done in the Form's Open event. See VBA Help for good info on
how you use it.

If the SQL you are trying to send to the form is the data you want for your
form, then you should make that the Record Source for the form. And, if you
are trying to filter what data is presented in the form. Then the usual
method is to construct a WHERE Clause without the word Where and use that in
the OpenForm method as the Where argument. Again, look in VBA Help for info
on OpenForm.

As to the SQL you have for your combo boxes. Take out the commas. Set your
Row Source type to Table/Query and put the SQL in the Row Source property.
You will have to make some adjustments to your combos to set the correct
number of columns, the bound column, and the column width properties.

Once you get this much going, post back with what is and is not working so
we can take it from there.
fsuds said:
I posted this in the forms forum but have yet to receive a response. I
figured maybe I could try this one. Thanks for any help.

----------------------------------------------------

I'm having trouble figuring out what I need to do here. Basically, I
want to pull data from several different tables and send them to a form
using open args. However, the form that is being fed need to have
certain columns of data concatenated and displayed in combo boxes. The text
boxes receive and display the correct data but my combo boxes remain blank.

Here is the code from my search form to feed the rental edit:

sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]," & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID],"
& _
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTAL.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM, RENTAL, EVENT" & _
" WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"


DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL

Here is the code for my 2 combo boxes on the edit form:

frmEditRental


cmbEVENT: SELECT ([RENTAL].[EventID]) & ", " & nz([EVENT].[Name]) & ",
" & nz([EVENT].[FILENUMBER]) AS Expr1
FROM EVENT INNER JOIN RENTAL ON [EVENT].[EVENTID]=[RENTAL].[EventID];


cmbPrice: SELECT [RENTALITEM].[RentalID], ([RENTAL.RENTALITEM]) & ", "
& ([RENTAL].[RENTALTYPE]) & ", " & ([RENTAL].[PRICEPERUNIT]) AS Expr1
FROM RENTAL INNER JOIN RENTALITEM ON
[RENTAL].[RentalID]=[RENTALITEM].[RentalID];


txtRentalDate: RentalDate
txtRID: RID
txtQuantity: Quantity


I also have a similar form setup for data entry and can select data through
the combo box but when I save the record, not all of the information is saved
in the table.

I'm absolutley stuck. All help is greatly appreciated.
 
F

fsuds

What I'm trying to do is recreate (as best as possible) a web front end in
access forms. I don't know much about DAPs yet so we're going this route.
I'm trying to make it look as close as possible to the current product.

Maybe I should just set the form up with more combos, set the bound column
to the UID (which is what needs to be updated/added in to the table) and
display column 2 with concatenated data. Seems to be the best route now as
I've been stuck on this for weeks.

Klatuu said:
You want the entire record in the combo? why?
A record is always selected. When you open a form, the first record in the
form's recordset is always displayed.

I guess I don't understand what it is you are actually trying to do.

fsuds said:
Sorry, guess I should have also put the Forms OnLoad Event

Me.RecordSource = Me.OpenArgs

One question. If I put my SQL into the row source property, that will pull
the data but will only display the bound column when a record is selected,
correct? I know that this sounds crazy but I was hoping to display all of
the information in the combo.

Thanks for the response and help so far.

Klatuu said:
The first problem you are having is how you are using the OpenArgs argument.
The form receiving the OpenARgs does nothing with it unless you code for it.
That is usually done in the Form's Open event. See VBA Help for good info on
how you use it.

If the SQL you are trying to send to the form is the data you want for your
form, then you should make that the Record Source for the form. And, if you
are trying to filter what data is presented in the form. Then the usual
method is to construct a WHERE Clause without the word Where and use that in
the OpenForm method as the Where argument. Again, look in VBA Help for info
on OpenForm.

As to the SQL you have for your combo boxes. Take out the commas. Set your
Row Source type to Table/Query and put the SQL in the Row Source property.
You will have to make some adjustments to your combos to set the correct
number of columns, the bound column, and the column width properties.

Once you get this much going, post back with what is and is not working so
we can take it from there.
:

I posted this in the forms forum but have yet to receive a response. I
figured maybe I could try this one. Thanks for any help.

----------------------------------------------------

I'm having trouble figuring out what I need to do here. Basically, I
want to pull data from several different tables and send them to a form
using open args. However, the form that is being fed need to have
certain columns of data concatenated and displayed in combo boxes. The text
boxes receive and display the correct data but my combo boxes remain blank.

Here is the code from my search form to feed the rental edit:

sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]," & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID],"
& _
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTAL.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM, RENTAL, EVENT" & _
" WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"


DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL

Here is the code for my 2 combo boxes on the edit form:

frmEditRental


cmbEVENT: SELECT ([RENTAL].[EventID]) & ", " & nz([EVENT].[Name]) & ",
" & nz([EVENT].[FILENUMBER]) AS Expr1
FROM EVENT INNER JOIN RENTAL ON [EVENT].[EVENTID]=[RENTAL].[EventID];


cmbPrice: SELECT [RENTALITEM].[RentalID], ([RENTAL.RENTALITEM]) & ", "
& ([RENTAL].[RENTALTYPE]) & ", " & ([RENTAL].[PRICEPERUNIT]) AS Expr1
FROM RENTAL INNER JOIN RENTALITEM ON
[RENTAL].[RentalID]=[RENTALITEM].[RentalID];


txtRentalDate: RentalDate
txtRID: RID
txtQuantity: Quantity


I also have a similar form setup for data entry and can select data through
the combo box but when I save the record, not all of the information is saved
in the table.

I'm absolutley stuck. All help is greatly appreciated.
 
F

fsuds

I should also clarify that I don't want the entire recordset in one combo.
The form is set up with multiple combos and text boxes I was just trying to
feed particular data to certain combos.

Klatuu said:
You want the entire record in the combo? why?
A record is always selected. When you open a form, the first record in the
form's recordset is always displayed.

I guess I don't understand what it is you are actually trying to do.

fsuds said:
Sorry, guess I should have also put the Forms OnLoad Event

Me.RecordSource = Me.OpenArgs

One question. If I put my SQL into the row source property, that will pull
the data but will only display the bound column when a record is selected,
correct? I know that this sounds crazy but I was hoping to display all of
the information in the combo.

Thanks for the response and help so far.

Klatuu said:
The first problem you are having is how you are using the OpenArgs argument.
The form receiving the OpenARgs does nothing with it unless you code for it.
That is usually done in the Form's Open event. See VBA Help for good info on
how you use it.

If the SQL you are trying to send to the form is the data you want for your
form, then you should make that the Record Source for the form. And, if you
are trying to filter what data is presented in the form. Then the usual
method is to construct a WHERE Clause without the word Where and use that in
the OpenForm method as the Where argument. Again, look in VBA Help for info
on OpenForm.

As to the SQL you have for your combo boxes. Take out the commas. Set your
Row Source type to Table/Query and put the SQL in the Row Source property.
You will have to make some adjustments to your combos to set the correct
number of columns, the bound column, and the column width properties.

Once you get this much going, post back with what is and is not working so
we can take it from there.
:

I posted this in the forms forum but have yet to receive a response. I
figured maybe I could try this one. Thanks for any help.

----------------------------------------------------

I'm having trouble figuring out what I need to do here. Basically, I
want to pull data from several different tables and send them to a form
using open args. However, the form that is being fed need to have
certain columns of data concatenated and displayed in combo boxes. The text
boxes receive and display the correct data but my combo boxes remain blank.

Here is the code from my search form to feed the rental edit:

sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]," & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID],"
& _
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTAL.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM, RENTAL, EVENT" & _
" WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"


DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL

Here is the code for my 2 combo boxes on the edit form:

frmEditRental


cmbEVENT: SELECT ([RENTAL].[EventID]) & ", " & nz([EVENT].[Name]) & ",
" & nz([EVENT].[FILENUMBER]) AS Expr1
FROM EVENT INNER JOIN RENTAL ON [EVENT].[EVENTID]=[RENTAL].[EventID];


cmbPrice: SELECT [RENTALITEM].[RentalID], ([RENTAL.RENTALITEM]) & ", "
& ([RENTAL].[RENTALTYPE]) & ", " & ([RENTAL].[PRICEPERUNIT]) AS Expr1
FROM RENTAL INNER JOIN RENTALITEM ON
[RENTAL].[RentalID]=[RENTALITEM].[RentalID];


txtRentalDate: RentalDate
txtRID: RID
txtQuantity: Quantity


I also have a similar form setup for data entry and can select data through
the combo box but when I save the record, not all of the information is saved
in the table.

I'm absolutley stuck. All help is greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top