RE: passing data to new form using open args

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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" wrote:

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" wrote:

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.

.



Relevant Pages

  • Re: Update table from form
    ... Game_TypeID but your SQL in your Row Source has Game_Type_ID. ... There are already 3 combo boxes on this form, that successfully update ...
    (microsoft.public.access.forms)
  • RE: Data in Recordset to fill a List Box?
    ... statement in the list box's Row Source property in the the properties dialog ... In Jet SQL, you also need the; at the end of the statement. ... First, a list box is just a control, so you would address it as a control on ... make that the row source of the list box. ...
    (microsoft.public.access.modulesdaovba)
  • Re: Pie Chart Legend Lables
    ... Change the SQL of the Row Source property. ... > labels so that they are more meaningful to my end user who won't know ...
    (microsoft.public.access.reports)
  • Re: Unable to reset Combo Box Data Field Format.
    ... Regards to mixed data types and the combo boxes - ... controls from the target SQL statement. ... > either selecting values from the combo box row source or by typing them> it ... > based on other combo box selections of fields in the DB. ...
    (microsoft.public.access.forms)
  • Re: Combo Box Help
    ... This is the SQL View from the Row Source of cboAgencyName: ... I set the criteria under the StateName field in this query. ... post the SQL. ... that I can only select the first record in the second combo box. ...
    (microsoft.public.access.formscoding)