Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old August 9th, 2006, 08:05 PM
fredindy
Guest
 
Posts: n/a
Default sql and passing through open args

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. Here is the code I have so far.
I'm sure it's not right because it doesn't work right.

Private Sub cmdEdit_Click()
Dim sSQL As String

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


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

Thanks for any help.

Fred

  #2  
Old August 9th, 2006, 09:55 PM
Jeff L
Guest
 
Posts: n/a
Default Re: sql and passing through open args

Try this:

DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL

Hope that helps!



fredindy wrote:
Quote:
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. Here is the code I have so far.
I'm sure it's not right because it doesn't work right.
>
Private Sub cmdEdit_Click()
Dim sSQL As String
>
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]" & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID]" &
_
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM " & _
"WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"
>
>
DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL
End Sub
>
Thanks for any help.
>
Fred
  #3  
Old August 10th, 2006, 02:15 AM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

The form being opened has Me.RecordSource = Me.OpenArgs in the On Load
event. Would this be the same as what you've stated?

Jeff L wrote:
Quote:
Try this:
>
DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL
>
Hope that helps!
>
>
>
fredindy wrote:
Quote:
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. Here is the code I have so far.
I'm sure it's not right because it doesn't work right.

Private Sub cmdEdit_Click()
Dim sSQL As String

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


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

Thanks for any help.

Fred
  #4  
Old August 10th, 2006, 02:35 AM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

When I click on cmdEdit here is the error I get.

Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.

fredindy wrote:
Quote:
The form being opened has Me.RecordSource = Me.OpenArgs in the On Load
event. Would this be the same as what you've stated?
>
Jeff L wrote:
Quote:
Try this:

DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL

Hope that helps!



fredindy wrote:
Quote:
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. Here is the code I have so far.
I'm sure it's not right because it doesn't work right.
>
Private Sub cmdEdit_Click()
Dim sSQL As String
>
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]" & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID]" &
_
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM " & _
"WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"
>
>
DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL
End Sub
>
Thanks for any help.
>
Fred
  #5  
Old August 10th, 2006, 07:05 AM
pietlinden@hotmail.com
Guest
 
Posts: n/a
Default Re: sql and passing through open args


fredindy wrote:
Quote:
When I click on cmdEdit here is the error I get.
>
Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.
>
before setting anything, make sure your SQL statement works.

build up to the SQL statement (sSQL = ....)

then use Debug.Print to output ot the immediate window. Copy all that,
paste it into a blank query (click the SQL button), and run the query.
If that works, your problem is elsewhere.

  #6  
Old August 10th, 2006, 12:35 PM
Terry Kreft
Guest
 
Posts: n/a
Default Re: sql and passing through open args

You've got a couple of commas (,) missing

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



--

Terry Kreft


"fredindy" <fsudler@yahoo.comwrote in message
news:1155174200.920399.18960@q16g2000cwq.googlegro ups.com...
Quote:
When I click on cmdEdit here is the error I get.
>
Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.
>
fredindy wrote:
Quote:
The form being opened has Me.RecordSource = Me.OpenArgs in the On Load
event. Would this be the same as what you've stated?

Jeff L wrote:
Quote:
Try this:
>
DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL
>
Hope that helps!
>
>
>
fredindy wrote:
I'm having trouble figuring out what I need to do here. Basically,
I
Quote:
Quote:
Quote:
want to pull data from several different tables and send them to a
form
Quote:
Quote:
Quote:
using open args. However, the form that is being fed need to have
certain columns of data concatenated. Here is the code I have so
far.
Quote:
Quote:
Quote:
I'm sure it's not right because it doesn't work right.

Private Sub cmdEdit_Click()
Dim sSQL As String

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


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

Thanks for any help.

Fred
>

  #7  
Old August 10th, 2006, 02:05 PM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

I noticed that this morning and fixed it. Now, it is asking me for the
values of RID and EVENTID. Not sure if there are any past that because
I didn't have an exact event ID to plug in at that moment.
Terry Kreft wrote:
Quote:
You've got a couple of commas (,) missing
>
Should be something like:-
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME], " _
& "EVENT.[FILENUMBER], RENTAL.[RENTALDATE], " _
& "RENTALITEM.[RENTALID], " _
& "RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE], " _
& "RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY] " _
& "FROM RENTALITEM " _
& "WHERE RENTAL.[RID] = forms![frmRentalSearch].[RID]"
>
>
>
--
>
Terry Kreft
>
>
"fredindy" <fsudler@yahoo.comwrote in message
news:1155174200.920399.18960@q16g2000cwq.googlegro ups.com...
Quote:
When I click on cmdEdit here is the error I get.

Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.

fredindy wrote:
Quote:
The form being opened has Me.RecordSource = Me.OpenArgs in the On Load
event. Would this be the same as what you've stated?
>
Jeff L wrote:
Try this:

DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL

Hope that helps!



fredindy wrote:
I'm having trouble figuring out what I need to do here. Basically,
I
Quote:
Quote:
want to pull data from several different tables and send them to a
form
Quote:
Quote:
using open args. However, the form that is being fed need to have
certain columns of data concatenated. Here is the code I have so
far.
Quote:
Quote:
I'm sure it's not right because it doesn't work right.
>
Private Sub cmdEdit_Click()
Dim sSQL As String
>
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]" & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE],
RENTALITEM.[RENTALID]" &
Quote:
Quote:
_
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM " & _
"WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"
>
>
DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL
End Sub
>
Thanks for any help.
>
Fred
  #8  
Old August 10th, 2006, 02:45 PM
Terry Kreft
Guest
 
Posts: n/a
Default Re: sql and passing through open args

If it's popping a dialog up to ask for those values then check that the
fields actually appear in the tables and that you have spelt the fieldnames
correctly.

--

Terry Kreft


"fredindy" <fsudler@yahoo.comwrote in message
news:1155215830.346906.20160@m79g2000cwm.googlegro ups.com...
Quote:
I noticed that this morning and fixed it. Now, it is asking me for the
values of RID and EVENTID. Not sure if there are any past that because
I didn't have an exact event ID to plug in at that moment.
Terry Kreft wrote:
Quote:
You've got a couple of commas (,) missing

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



--

Terry Kreft


"fredindy" <fsudler@yahoo.comwrote in message
news:1155174200.920399.18960@q16g2000cwq.googlegro ups.com...
Quote:
When I click on cmdEdit here is the error I get.
>
Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.
>
fredindy wrote:
The form being opened has Me.RecordSource = Me.OpenArgs in the On
Load
Quote:
Quote:
Quote:
event. Would this be the same as what you've stated?

Jeff L wrote:
Try this:
>
DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL
>
Hope that helps!
>
>
>
fredindy wrote:
I'm having trouble figuring out what I need to do here.
Basically,
Quote:
Quote:
I
Quote:
want to pull data from several different tables and send them to
a
Quote:
Quote:
form
Quote:
using open args. However, the form that is being fed need to
have
Quote:
Quote:
Quote:
certain columns of data concatenated. Here is the code I have
so
Quote:
Quote:
far.
Quote:
I'm sure it's not right because it doesn't work right.

Private Sub cmdEdit_Click()
Dim sSQL As String

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


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

Thanks for any help.

Fred
>
>

  #9  
Old August 10th, 2006, 02:55 PM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

Actually, on the form it's feeding, I have 2 combo boxes that have
concatenated data in them. I'll check and make sure that all the field
names and tables are correct but I wonder that since the data is
concatenated, that might be causing the issue.

Terry Kreft wrote:
Quote:
If it's popping a dialog up to ask for those values then check that the
fields actually appear in the tables and that you have spelt the fieldnames
correctly.
>
--
>
Terry Kreft
>
>
"fredindy" <fsudler@yahoo.comwrote in message
news:1155215830.346906.20160@m79g2000cwm.googlegro ups.com...
Quote:
I noticed that this morning and fixed it. Now, it is asking me for the
values of RID and EVENTID. Not sure if there are any past that because
I didn't have an exact event ID to plug in at that moment.
Terry Kreft wrote:
Quote:
You've got a couple of commas (,) missing
>
Should be something like:-
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME], " _
& "EVENT.[FILENUMBER], RENTAL.[RENTALDATE], " _
& "RENTALITEM.[RENTALID], " _
& "RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE], " _
& "RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY] " _
& "FROM RENTALITEM " _
& "WHERE RENTAL.[RID] = forms![frmRentalSearch].[RID]"
>
>
>
--
>
Terry Kreft
>
>
"fredindy" <fsudler@yahoo.comwrote in message
news:1155174200.920399.18960@q16g2000cwq.googlegro ups.com...
When I click on cmdEdit here is the error I get.

Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.

fredindy wrote:
The form being opened has Me.RecordSource = Me.OpenArgs in the On
Load
Quote:
Quote:
event. Would this be the same as what you've stated?
>
Jeff L wrote:
Try this:

DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL

Hope that helps!



fredindy wrote:
I'm having trouble figuring out what I need to do here.
Basically,
Quote:
Quote:
I
want to pull data from several different tables and send them to
a
Quote:
Quote:
form
using open args. However, the form that is being fed need to
have
Quote:
Quote:
certain columns of data concatenated. Here is the code I have
so
Quote:
Quote:
far.
I'm sure it's not right because it doesn't work right.
>
Private Sub cmdEdit_Click()
Dim sSQL As String
>
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]" & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE],
RENTALITEM.[RENTALID]" &
_
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM " & _
"WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"
>
>
DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL
End Sub
>
Thanks for any help.
>
Fred
  #10  
Old August 10th, 2006, 03:15 PM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

Here is the SQL from both forms

frmSearchRental

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

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

fredindy wrote:
Quote:
Actually, on the form it's feeding, I have 2 combo boxes that have
concatenated data in them. I'll check and make sure that all the field
names and tables are correct but I wonder that since the data is
concatenated, that might be causing the issue.
>
Terry Kreft wrote:
Quote:
If it's popping a dialog up to ask for those values then check that the
fields actually appear in the tables and that you have spelt the fieldnames
correctly.

--

Terry Kreft


"fredindy" <fsudler@yahoo.comwrote in message
news:1155215830.346906.20160@m79g2000cwm.googlegro ups.com...
Quote:
I noticed that this morning and fixed it. Now, it is asking me for the
values of RID and EVENTID. Not sure if there are any past that because
I didn't have an exact event ID to plug in at that moment.
Terry Kreft wrote:
You've got a couple of commas (,) missing

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



--

Terry Kreft


"fredindy" <fsudler@yahoo.comwrote in message
news:1155174200.920399.18960@q16g2000cwq.googlegro ups.com...
When I click on cmdEdit here is the error I get.
>
Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.
>
fredindy wrote:
The form being opened has Me.RecordSource = Me.OpenArgs in the On
Load
Quote:
event. Would this be the same as what you've stated?

Jeff L wrote:
Try this:
>
DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL
>
Hope that helps!
>
>
>
fredindy wrote:
I'm having trouble figuring out what I need to do here.
Basically,
Quote:
I
want to pull data from several different tables and send them to
a
Quote:
form
using open args. However, the form that is being fed need to
have
Quote:
certain columns of data concatenated. Here is the code I have
so
Quote:
far.
I'm sure it's not right because it doesn't work right.

Private Sub cmdEdit_Click()
Dim sSQL As String

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


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

Thanks for any help.

Fred
>
>
  #11  
Old August 10th, 2006, 08:45 PM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

I have adjusted my code a little. I noticed that I was missing a
couple of columns so I added them in. No more errors when I click the
cmdEdit button however, I do not have all of my data on the new form.
Could this be from concatenating data in the combo box source and not
in sSQL? Below is my updated code. Thanks for all the help so far.


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


fredindy wrote:
Quote:
Here is the SQL from both forms
>
frmSearchRental
>
sSQL: Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME],
EVENT.[FILENUMBER], RENTAL.[RENTALDATE], RENTALITEM.[RENTALID],
RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY]
FROM RENTALITEM
WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]
>
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
>
fredindy wrote:
Quote:
Actually, on the form it's feeding, I have 2 combo boxes that have
concatenated data in them. I'll check and make sure that all the field
names and tables are correct but I wonder that since the data is
concatenated, that might be causing the issue.

Terry Kreft wrote:
Quote:
If it's popping a dialog up to ask for those values then check that the
fields actually appear in the tables and that you have spelt the fieldnames
correctly.
>
--
>
Terry Kreft
>
>
"fredindy" <fsudler@yahoo.comwrote in message
news:1155215830.346906.20160@m79g2000cwm.googlegro ups.com...
I noticed that this morning and fixed it. Now, it is asking me for the
values of RID and EVENTID. Not sure if there are any past that because
I didn't have an exact event ID to plug in at that moment.
Terry Kreft wrote:
You've got a couple of commas (,) missing
>
Should be something like:-
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME], " _
& "EVENT.[FILENUMBER], RENTAL.[RENTALDATE], " _
& "RENTALITEM.[RENTALID], " _
& "RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE], " _
& "RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY] " _
& "FROM RENTALITEM " _
& "WHERE RENTAL.[RID] = forms![frmRentalSearch].[RID]"
>
>
>
--
>
Terry Kreft
>
>
"fredindy" <fsudler@yahoo.comwrote in message
news:1155174200.920399.18960@q16g2000cwq.googlegro ups.com...
When I click on cmdEdit here is the error I get.

Run-time error '3075'
Syntax error (missing operator) in query expression 'EVENT.[NAME]
EVENT.[FILENUMBER]'.

fredindy wrote:
The form being opened has Me.RecordSource = Me.OpenArgs in the On
Load
event. Would this be the same as what you've stated?
>
Jeff L wrote:
Try this:

DoCmd.OpenForm "frmEditRental", acNormal
Forms!frmEditRental.RecordSource = sSQL

Hope that helps!



fredindy wrote:
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. Here is the code I have
so
far.
I'm sure it's not right because it doesn't work right.
>
Private Sub cmdEdit_Click()
Dim sSQL As String
>
sSQL = "Select RENTAL.[RID], RENTAL.[EVENTID], EVENT.[NAME]" & _
" EVENT.[FILENUMBER], RENTAL.[RENTALDATE],
RENTALITEM.[RENTALID]" &
_
" RENTAL.[RENTALITEM], RENTAL.[RENTALTYPE]," & _
" RENTALITEM.[PRICEPERUNIT], RENTAL.[QUANTITY]" & _
" FROM RENTALITEM " & _
"WHERE forms![frmRentalSearch].[RID] = RENTAL.[RID]"
>
>
DoCmd.OpenForm "frmEditRental", acNormal, OpenArgs:=sSQL
End Sub
>
Thanks for any help.
>
Fred
  #12  
Old August 14th, 2006, 11:55 PM
Bri
Guest
 
Posts: n/a
Default Re: sql and passing through open args


fredindy wrote:
Quote:
I have adjusted my code a little. I noticed that I was missing a
couple of columns so I added them in. No more errors when I click the
cmdEdit button however, I do not have all of my data on the new form.
Could this be from concatenating data in the combo box source and not
in sSQL? Below is my updated code. Thanks for all the help so far.
If the ComboBoxes are bound to one of the fields, then you need to NOT
have the concatinated values as the Bound Column. The bound control
needs to have the bound column be the field in the table or query. If
you do not want that column to display then set its width to 0 (zero).

--
Bri

  #13  
Old August 15th, 2006, 09:35 PM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

The bound column is the UID and is hidden. For instance an employee
named Joe S. Blow has the EmployeeID of 29 it SHOULD show, Blow, Joe,
S. in the cmb. Blow, Joe, S. being the data concatenated in column 2
and 29 hidden in column 1.

I also have a form setup similar to this one that is strictly for
entering new data. Using the same code, I have all the data available
to me to select. However, when I save it, the record in the table
doesn't have all of the selected data. I'm absolutley lost here.

Fred
Bri wrote:
Quote:
fredindy wrote:
Quote:
I have adjusted my code a little. I noticed that I was missing a
couple of columns so I added them in. No more errors when I click the
cmdEdit button however, I do not have all of my data on the new form.
Could this be from concatenating data in the combo box source and not
in sSQL? Below is my updated code. Thanks for all the help so far.
>
If the ComboBoxes are bound to one of the fields, then you need to NOT
have the concatinated values as the Bound Column. The bound control
needs to have the bound column be the field in the table or query. If
you do not want that column to display then set its width to 0 (zero).
>
--
Bri
  #14  
Old August 16th, 2006, 04:05 AM
Bri
Guest
 
Posts: n/a
Default Re: sql and passing through open args

Sounds like you are doing the combo's right. Not sure what you are
doing wrong though. Sorry.

Bri

fredindy wrote:
Quote:
The bound column is the UID and is hidden. For instance an employee
named Joe S. Blow has the EmployeeID of 29 it SHOULD show, Blow, Joe,
S. in the cmb. Blow, Joe, S. being the data concatenated in column 2
and 29 hidden in column 1.
>
I also have a form setup similar to this one that is strictly for
entering new data. Using the same code, I have all the data available
to me to select. However, when I save it, the record in the table
doesn't have all of the selected data. I'm absolutley lost here.
>
Fred
  #15  
Old August 17th, 2006, 02:15 PM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

Anyone have any ideas?
Bri wrote:
Quote:
Sounds like you are doing the combo's right. Not sure what you are
doing wrong though. Sorry.
>
Bri
>
fredindy wrote:
Quote:
The bound column is the UID and is hidden. For instance an employee
named Joe S. Blow has the EmployeeID of 29 it SHOULD show, Blow, Joe,
S. in the cmb. Blow, Joe, S. being the data concatenated in column 2
and 29 hidden in column 1.

I also have a form setup similar to this one that is strictly for
entering new data. Using the same code, I have all the data available
to me to select. However, when I save it, the record in the table
doesn't have all of the selected data. I'm absolutley lost here.

Fred
  #16  
Old August 24th, 2006, 07:15 PM
fredindy
Guest
 
Posts: n/a
Default Re: sql and passing through open args

Still in need of help.
fredindy wrote:
Quote:
Anyone have any ideas?
Bri wrote:
Quote:
Sounds like you are doing the combo's right. Not sure what you are
doing wrong though. Sorry.

Bri

fredindy wrote:
Quote:
The bound column is the UID and is hidden. For instance an employee
named Joe S. Blow has the EmployeeID of 29 it SHOULD show, Blow, Joe,
S. in the cmb. Blow, Joe, S. being the data concatenated in column 2
and 29 hidden in column 1.
>
I also have a form setup similar to this one that is strictly for
entering new data. Using the same code, I have all the data available
to me to select. However, when I save it, the record in the table
doesn't have all of the selected data. I'm absolutley lost here.
>
Fred
 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles