Bug in query

  • Thread starter Thread starter Dana
  • Start date Start date
D

Dana

Hi,

I'm trying to use a text box's value in a query.
i'm using it as an expresion of the sort:
SELECT Forms!form1![form1 subform].Form!CustomerID AS
Expr1

but the query displayes it as all kind of signs instead
of a number.
when i run a create table query, i saw that it gave that
field the type "binary". how can i fix that?

2nd question: How can i run an sql query from a VBA code?

thanks,

dana
 
Dana

As I read your SQL statement, you are asking Access to select the value
contained in a form control. But SQL statements are meant to be run against
a set of data. Are you trying to use the value of the text box as a
selection criterion in a query?

Instead of describing 'how' you want to do something, consider posting
'what' you want to accomplish, and see what the 'group readers can offer.
An example might be "I want to see all the rows in my xxxx table that have
the ID that's in my form" ... and I want to show them in another form.
 
It looks like your database is hosed..... Does it look
ok in the textbox? Given that it displays as 'all kinds
of signs', I guess it's no surprising that Access creates
a 'binary' field for the data. What version of Access
are you using? Have you applied all updates and patches?

(david)
 
Hi,

It's 2003 ver. and it's the most recent.
what i need to do, is to run an update query, that uses
the value in the text box as an expression. (not a
criteria). for example, the text box in the form shows a
customer id value. i need to run an append query, when
one of the fields im updating is that customer id.
but, it displayes it as signes instead of the number
(id).

can you assist?

thanks

-----Original Message-----
It looks like your database is hosed..... Does it look
ok in the textbox? Given that it displays as 'all kinds
of signs', I guess it's no surprising that Access creates
a 'binary' field for the data. What version of Access
are you using? Have you applied all updates and patches?

(david)

Hi,

I'm trying to use a text box's value in a query.
i'm using it as an expresion of the sort:
SELECT Forms!form1![form1 subform].Form!CustomerID AS
Expr1

but the query displayes it as all kind of signs instead
of a number.
when i run a create table query, i saw that it gave that
field the type "binary". how can i fix that?

2nd question: How can i run an sql query from a VBA code?

thanks,

dana


.
 
Any chance that you have table fields that are defined as "lookup" data
types?

Have you made a backup copy and then run Compact/Repair?

Could you post the full text of your SQL statement?
 
Hi,
Here's the query that i'm trying to run:

INSERT INTO CustomerSelections ( SelectionID, Selected,
CustomerID )
SELECT CustomerSelections.SelectionID,
CustomerSelections.Selected, Forms!Form1![Selections
subform].Form!CustomerID AS Expr1
FROM CustomerSelections
WHERE (((CustomerSelections.CustomerID)=[Forms]![Form1]!
[ID]));

now, im using the customerid text box for a value to be
insert.
i dont have a definition of a lookup (not that i know
of), and i tried also the repair.
i can't seem to solve this problem...

Can you help?

Thanks in advance
 
Is there a chance your Form1 doesn't have a control named "ID"? I'll
mention that if the underlying table field and the form control have the
same name, Access might be getting confused.

And if your field name is actually "ID", this may be a reserved word in
Access, causing further confusion. If so, consider changing the table field
to something less ambiguous (?CustomerID).
 
Hi Jeff,

I guess,it's some kind of a bug that can't be
resolved..the name does not seem to be the problem.

can you tell me how can i run the query (sql command)
from the VBA event window. i can assign the control value
to a variable, and use it in that way.

Thanks in advance!
 
That will depend on whether it is an action query or a simple select
statement.

Take a look at Access HELP on the

DoCmd.RunSQL

command, and on the

Execute

and

OpenRecordset

commands.
 
Back
Top