Whats Wrong With This Code

Jul 11, 2006

I placed a combo box named CboSearchItem on form to select and bring the record onto the form. Its working smoothly.

Set rst1 = CurrentDb.OpenRecordset("Select * From Product_Master " & _
"where Productname= " & """" & CboSearchItem & """")

But when data in field 'ProductName' contains " mark, it produces error 3075 :

Syntax error in string in query expression "ProductName = "Hose White 3/4"'"

When I replaced all " mark from the data / record, it works fine.
For example Product Name are as follows:

Elbow 2 Way
ABC Pipe 3"
Shower Pipe 1 1/5 Meter

Reading all the above record but not the second one because it contains " mark.

I can not tell my client not to use " symbol while entering the product name. There should be a solution.

Please extend your help.

With kind regards,
Ashfaque

View Replies


ADVERTISEMENT

Whats Going Wrong

Jul 3, 2007

I am trying to do a partial duplication query. this is the code from the SQL view in accessSELECT filtered1.Company_NameFROM filtered1WHERE (((filtered1.Company_Name) In (SELECT [Company_Name] FROM [filtered1] As Tmp GROUP BY [Company_Name], Left([Company_Name],7) HAVING Count(*)>1 And Left([Company_Name],7) = Left([filtered1].[Company_Name],7))))ORDER BY filtered1.Company_Name;the table filtered1 has 1300 records, under the field Company_Name.the 7's apparently should get it to compare the first 7 letters, and if the same show me them. A whats going wrong, its not showing me any, asthough there are none, (which i know there are) and B. How would i get it to compare the first 7 letters across tables, with fields of the same name?thanksalex

View 3 Replies View Related

Whats Wrong?

Jan 19, 2005

Private Sub Save_Click()

Dim sSemester As String

sSemester = Semester1.value

DoCmd.RunSQL "INSERT INTO Hours (Semester) " & _
" VALUES('" + [sSemester] + "'); "

End Sub

keep getting syntax error
basically Semester1 is a text box with an input mask : LLL???" '"00;0;

View 6 Replies View Related

Whats Wrong?!

Feb 25, 2005

"Microsoft JScript runtime error 'null' is null or not an object line = 126, col = 7 (line is offset from the start of the script block). Error returned from property or method call." what does that mean?

View 1 Replies View Related

Whats Wrong With This Formula?

Oct 23, 2005

As state above that whats wrong with the following formula?

=iff([Product]=Home,1,0)

:confused:

View 2 Replies View Related

Whats Wrong With This Sql Statement?

Sep 1, 2005

SELECT Fields
FROM table1 RIGHT JOIN table2 ON table1.Pubid = table2.PubID
WHERE (table1.PubType=[Forms]![frmCirculationByTitle]![comMemberType] Or [Forms]![frmCirculationByTitle]![comMemberType] Is null)
AND (table2.lAuditPeriod=[Forms]![frmCirculationByTitle]![comStartPeriod] Or [Forms]![frmCirculationByTitle]![comStartPeriod] IS null)
And (table2.lAuditPeriod=[Forms]![frmCirculationByTitle]![comEndPeriod] Or [Forms]![frmCirculationByTitle]![comEndPeriod] is null)
AND (table2.Unfinancial=[Forms]![frmCirculationByTitle]![chkCurrent] Or [Forms]![frmCirculationByTitle]![chkCurrent] IS null);

even if i only have one parameter (a member type, which should bring back at least 20 for each type of member) it returns nothing. if i do the same sql statement in a query and hard codee the value in i get data. it seems to be ignoring whatever is on the form.

*shrug*

%simon

View 2 Replies View Related

Whats Wrong With This Query?

Aug 15, 2006

trying to create a table using a query, and I'm not sure whats wrong with this query:

CREATE TABLE FYIAdmin
(
FYI_ID COUNTER CONSTRAINT PRIMARY KEY,
FYI_Title varchar(100),
FYI_Text memo,
FYI_Date date
)

Sorry it its noobish :(

View 2 Replies View Related

Help Needed Urgently - Whats Wrong In This SQL Statement

Mar 11, 2006

SELECT (Max(ReferenceDescription.ReferenceID))
FROM (ReferenceDescription)
WHERE (ReferenceDescription.ReferenceID >= (ReferenceDescription.CategoryID * ReferenceDescription.DepartmentID) AND ReferenceDescription.ReferenceID <= (INT(ReferenceDescription.CategoryID * ReferenceDescription.DepartmentID * 0.9999))

View 1 Replies View Related

What Is Wrong With This Code?

Aug 4, 2006

Hi all,
I have a form called frmrgstr with three text boxes, one combo box, and one button. Also, I have a table called info with four columns. That form "frmrgstr" is not based on any table.
What I want is, that to send data from the form to the table after clicking the button for the form.

I did the required code:

Dim x As String
x = "INSERT INTO info(UserName, PassWord, Email, Gender) VALUES(Me.Text0, Me.Text2, Me.Text4, Me.Combo29)"

UserName = Me.Text0.Value
Me.Text0.SetFocus

Password = Me.Text2.Value
Me.Text2.SetFocus

Email = Me.Text4.Value
Me.Text4.SetFocus

Gender = Me.Combo29.Value
Me.Combo29.SetFocus

DoCmd.RunSQL x
MsgBox "Welcome! " & Me.Text0

But after running the code, each time it will ask me about the value of text0, text2, text4, and combo29.
So please, what is wrong with that code......?????
See the attached file.

Thanks in advance....

Regards

Mark K.

View 2 Replies View Related

What's Wrong With This Code?

Oct 28, 2004

The following code is for a delete button that is supposed to delete a job. However, in order to delete a job, related records (in tblJobDetails and tblLaborDetails) need to be deleted first. What I did was try to open the record source and delete them, and then once they're all deleted, delete the job. When I click the button, though, no action is taken and I get the error message:

The record cannot be deleted or changed because table 'tblJobDetails' (or tblLaborDetails if tblJobDetails is empty) includes related records.

Is there any way to get this code to work without making the relationships cascade delete?

Thanks a lot

-Jason

Code: Private Sub cmdDeleteJob_Click()On Error GoTo Err_cmdDeleteJob_ClickDim dbRoofing As DAO.DatabaseDim rcdJobDetails As DAO.RecordsetDim intJobID As IntegerDim intMaterialID As IntegerSet dbRoofing = CurrentDbintJobID = Me!JobID'clear out materialsSet rcdJobDetails = dbRoofing.OpenRecordset("tblJobDetails")rcdJobDetails.FindFirst "JobID =" & intJobIDIf rcdJobDetails.NoMatch = False ThenDoDoCmd.DoMenuItem acFormBar, acEditMenu, 9, , acMenuVer70DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70rcdJobDetails.FindNext "JobID =" & intJobIDLoop Until rcdJobDetails.NoMatch = TrueEnd If'clear out laborDim rcdLaborDetails As DAO.RecordsetDim intServiceID As IntegerSet rcdLaborDetails = dbRoofing.OpenRecordset("tblLaborDetails")rcdLaborDetails.FindFirst "JobID =" & intJobIDIf rcdLaborDetails.NoMatch = False ThenDoDoCmd.DoMenuItem acFormBar, acEditMenu, 9, , acMenuVer70DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70rcdLaborDetails.FindNext "JobID =" & intJobIDLoop Until rcdLaborDetails.NoMatch = TrueEnd If'delete jobDoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70Exit_cmdDeleteJob_Click:Exit SubErr_cmdDeleteJob_Click:MsgBox Err.DescriptionResume Exit_cmdDeleteJob_ClickEnd Sub

View 6 Replies View Related

What Wrong With This Listbox Code?

Dec 14, 2005

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Logins"
stLinkCriteria = "[ID]=" & "'" & Me![lstLogins] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria

This code is on the doubleclick event.

lstLogins is sourced from this: SELECT Logins.[ID], Logins.[Login for] FROM Logins WHERE (((Logins.Customer)=[forms]![customers]![customer]));

When i run it I get a VB error "The OpenForm action was cancelled", and the debugger stops on the last line above (Do.Cmd...)

Any ideas why?

I know [ID] is a long integer, but I tried formatting it with Str just in case and it made no difference :(

View 2 Replies View Related

Whats The Best Way To Do This?

Jun 13, 2007

Hello,

I have a database which every week I have to import an excel spreadsheet. Now this spread sheet will always have rows that repeat and will have somewhere between 700-1500 rows.

What is my best option to delete the rows that repeat? Meaning if a rows 1-10 have the same data then delete 9 of them. It will vary but I only need the unique record and the others can be deleted.

Would this be best way using a query? VB or something else?

There are 6 columns that will always be in the spreadsheet with the same column names:

ACCT_NUMBER
SHORT_ACCOUNT_TITLE
CONTACT_COMMENTS
CONTACT_TYPE_TEXT
ENTERED_BY
INITIAL_CONTACT_DATE
DATE_ENTERED

There will be rows that will repeat on every spreadsheet everytime. The only column that will not repeat will be CONTACT_COMMENTS. This column is needs to be deleted everytime.

I guess I didnt know if when I import the spreadsheet if something was possible that would:

Delete the CONTACT_COMMENTS then delete the duplicate rows upon importing or even after since this will have to be done everytime.

Thanks.

View 4 Replies View Related

Whats Your Price?

Jan 2, 2006

After being a member on this site for a while now I would like to get some opinions on "cost of application development" I know the forum covers a wide geographic area and the members cover a wide spectrum of degrees of expertise on Access and application development. So the question is this..What would your rates be and how would you determine your charges for developing Access applications for a business?PS... Please include your location if not in your profile.

View 13 Replies View Related

Whats Your Thought On This?

Aug 30, 2004

If I am going to get a Invoice/Statement programme made for me should it be in MS Access or Visual Basic, Thanks for your thoughts, Bob Vance

View 2 Replies View Related

Whats Controlling These Decimals?

Jan 5, 2007

Hello,

Dont understand what is controlling these decimals. I dont need any decimals for this database. The currency is talking bout money in 1000's and the probability is whole numbers.

Here is where I cant get the decimals to stop:

http://img80.imageshack.us/img80/3685/untitled2pl2.png
http://img77.imageshack.us/img77/6276/untitled3pa6.png
http://img208.imageshack.us/img208/2047/untitled3lk8.png

I have tried different things but no luck...anyone have any suggestions.

Thanks.

View 10 Replies View Related

Whats Better For Database Design?

Aug 17, 2007

I need to store a question like...

I felt scared...
[]Before I was on the roller coaster
[]When I was on the roller coaster
[]After I was on the roller coaster

I need to be able to query/search the database for people that were scared "before", "during", "after", "before and during", "before and after", "during and after". Then I can categorize these people. What would be the best way to do it? Should I have 3 "yes/no" fields in my table, or one text field with those 3 as the lookup field? What one would make organizing the people easier? :D Thanks!

View 7 Replies View Related

Whats Better For Database Design?

Aug 17, 2007

I need to store a question like...

I felt scared...
[]Before I was on the roller coaster
[]When I was on the roller coaster
[]After I was on the roller coaster

I need to be able to query/search the database for people that were scared "before", "during", "after", "before and during", "before and after", "during and after". Then I can categorize these people. What would be the best way to do it? Should I have 3 "yes/no" fields in my table, or one text field with those 3 as the lookup field? What one would make organizing the people easier?

View 1 Replies View Related

Switchboard Whats The Real Advantage?

Jan 25, 2007

Hello,

My database is due tommorrow and my switchboard has gone crazy on me, it doesnt work anymore. When you scrolll your mouse it then goes through the links thats the only way to get to the section you want.

So question is this, whats the advantage of using it?

Cant I just set some hyperlinks to the items I want and it would be the same. Wondering cause dont know if I should spend time trying to fix it or just make hyperlinks...and its due tommorrow.

Thanks for any opinions.

View 12 Replies View Related

Whats The Difference Between Frontend And Backend Database

Jun 22, 2006

Hi people,
Does anyone knows the difference between frontend and backend database? I look 4ward to hearing from any database expert.

black85

View 1 Replies View Related

Please Review This Code, (simple Code) New With Codes

Feb 16, 2006

Works great, but when I hit the number "3", (3 times in row) it will let me into the form. I want it to not let me in IF I don't know the password.

Where did I go wrong?

Private Sub Form_Load()
Dim pw As Variant

If InputBox("What is the password?", "Password") = "1" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
If InputBox("What is the password?", "Password") = "2" Then
Else
MsgBox "Invalid Password", vbCritical, "Sorry Charlie"
DoCmd.Close
End If
End If


End Sub

View 14 Replies View Related

Using Code To Unprotect And Protect Viewing Code

Jan 14, 2007

I protect my code from people being able to read it by setting a password on the code from Tools > Properties, selecting the Protection tab and entering a password, and clicking "Lock Project"

Is there a way to write code that will remove that Lock Project check and check it back on?

I've looked through the Application.SetOption command and it doesn't seem to be one of the choices. It would be very helpful if someone knew how to do this.

Thanks

SHADOW

View 6 Replies View Related

Now Its All Gone Wrong!!!

Sep 21, 2005

Ok Guys,

Here goes...

all of a sudden now, when i open my form, its not displaying any of the previous data that i stored in it!! All the data is still in the table, and when i add data it goes into the table!! I checked properties and the record source and everything is ok there, what have i done wrong guys...HELP!!!!

View 3 Replies View Related

What's Wrong?

Jun 9, 2006

I purchased a copy of Office 2003, on Ebay, for less than half the price it normally sells for. I created databases, which work well on my computer. However, when I copy them over to the office computer from my computer, via Flash memory stick, the program does not run. The message seems to indicate a problem with registration. When I installed Access, it asked me for a registration key, which I did provide. After that it worked-not activation process. Does this mean that you can only use the computer you created the database on to run it, or that I do not have a proper version of Access 2003? I cannot transfer, from my home computer, to the office computer. Is this Microsoft paranoia again?
Subsequent uninstalls and reinstalls of the program did not ask for the installation key.
What should happen? I would like to resolve this major problem and your help will be greatly appreciated. The program is flaky. Also, Switchboard does not work-must use Option Box.

These questions most user must know about initial installation and copying mdb files to other computers -please reply.

View 2 Replies View Related

What's Wrong

Oct 16, 2006

Hi,
Can anyone tell me what's wrong with this:
DoCmd.RunSQL "INSERT INTO tblPersoaneJuridice (Denumire,Localitate,CodUnicInregistrare,NumarInre gistrareRegComertului,Telefon,Fax) VALUES ('" & Forms!frmPrincipal!subfrmTipVersus!txtDenumire & "','" & Forms!frmPrincipal!subfrmTipVersus!txtLocalitate & "','" & Forms!frmPrincipal!subfrmTipVersus!txtCUI & "','" & Forms!frmPrincipal!subfrmTipVersus!txtNumarInregis trare & "','" & Forms!frmPrincipal!subfrmTipVersus!txtTelefon & "','" & Forms!frmPrincipal!subfrmTipVersus!txtFax & "')"
cui = DLookup("[CodUnicInregistrare]", "[tblPersoaneJuridice]", "[NumarInregistrareRegComertului]='" & Me!subfrmTipVersus!txtNumarInregistrare & "'")

i have a string variable denoted by cui and i need it to take value from table tblPersoaneJuridice from field CodUnicInregistrare. CodUnicInregistrare and NumarInregistrareRegComertului is text.

View 3 Replies View Related

Would Someone Tell Me What's Wrong With This

Jun 14, 2007

Have not coded for about 5 years and need a little refresher. Can't remember what I need to do. Thanks

Dim SelectedCompany As String
Dim rs As ADODB.Recordset
Dim Cn As ADODB.Connection
Dim sSql As String

Set rs = New ADODB.Recordset
Set Cn = New ADODB.Connection

SelectedCompany = Me!cboCompanyName.Text

sSql = "select Customername, AddressLine1, AddressLine2, AddressLine3, AddressLine4, AddressLine5, AddressLine6 from customers where "
sSql = sSql & "CompanyName = '" & SelectedCompany & "'"

rs.Open sSql, Cn, adOpenStatic, adLockReadOnly

this last line fails with error "No value given for one or more required parameters."

The code is executed when someone selects something in a combo box on a form in an access database.

Thanks

Pete

View 4 Replies View Related

Am I Doing This Wrong

Oct 4, 2007

I think I'm just tired, and not seeing what to do here.

I have my main table.

MainID PK
bunch of other fields...

I also have a 'created by table'.

Createdby_ID PK
User ID
Main ID
Date_created.

I also have a user table, with a list of all the users.
User_ID PK
User_Name.


Is this the right way to setup these tables?
Only 1 person can create any paticular record.

I want it to be required tha whoever creates the record selects their name and dates it.

View 11 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved