Dear experts,
I need help on add control in VB..Im develping program and it will be read in MDB file..I have to avoid the double qoute in that program if the item description have the double code..For Eg.Laptop computer and if double qoute present on that i have to avoid that and output without the double code.
The second thing is i have control the item length and if the item length more than 40..i have to give some warning message..How i can do on that?
Kindly help me on this..Thanks - Dim db As DAO.Database
-
Dim rs1 As DAO.Recordset
-
Dim rs2 As DAO.Recordset
-
Dim rs3 As DAO.Recordset
-
Dim ProjID As DAO.Recordset
-
Dim strSQL As String
-
Dim intErrNo As Integer
-
Dim updCounter As Integer
-
Dim updStatus As Boolean
-
-
-
Function InsertIntoMaster()
-
Set db = CurrentDb
-
-
intErrNo = 0
-
-
strSQL = "SELECT * FROM Project_Counter WHERE Desc_Project='Chinastk'"
-
Set ProjID = db.OpenRecordset(strSQL)
-
-
strSQL = "SELECT * FROM NewItem WHERE Updated=0"
-
Set rs1 = db.OpenRecordset(strSQL)
-
-
strSQL = "DELETE * FROM [Outlet Item List]"
-
db.Execute strSQL
-
-
Do While Not rs1.EOF
-
updStatus = True
-
-
strSQL = "SELECT * FROM dbo_ChinaStk_ProdCat "
-
strSQL = strSQL & "WHERE PCCode='" & rs1("PCCode") & "' "
-
Set rs2 = db.OpenRecordset(strSQL)
-
If Not rs2.EOF Then
-
strHQMfgCode = rs2("PCBarCode") & Format(rs2("BarCodeCounter"), "0000000")
-
Set rs2 = Nothing
-
Else
-
intErrNo = intErrNo + 1
-
Set rs2 = Nothing
-
GoTo NextRec
-
End If
-
-
strSQL = "SELECT * FROM dbo_OP_Product_SubCategory "
-
strSQL = strSQL & "WHERE Product_Category='" & rs1("PCCode") & "' "
-
strSQL = strSQL & "AND Product_CategorySub='" & rs1("PSCCode") & "' "
-
Set rs2 = db.OpenRecordset(strSQL)
-
If rs2.EOF Then
-
intErrNo = intErrNo + 1
-
Set rs2 = Nothing
-
GoTo NextRec
-
End If
-
Set rs2 = Nothing
-
-
strItemDesc = ""
-
For intCount = 1 To Len(rs1("ItemDesc"))
-
If Mid(rs1("ItemDesc"), intCount, 1) <> "'" Then
-
strItemDesc = strItemDesc & Mid(rs1("ItemDesc"), intCount, 1)
-
End If
-
Next
-
-
strSQL = "INSERT INTO dbo_ChinaStk_Master (PrjID, "
-
strSQL = strSQL & "SetNo,PCCode,PBCode,PSCCode,ItemDesc,"
-
strSQL = strSQL & "UOM,StdCost,RSP,MthlyExpectSalesQty,CustomCode,"
-
strSQL = strSQL & "MfgBarCode,QtyOfUnit,ItemType,MeasurementUnit,UnitCode) "
-
strSQL = strSQL & "VALUES("
-
strSQL = strSQL & ProjID("Project_Counter") & ",'"
-
strSQL = strSQL & rs1("AccSet") & "','"
-
strSQL = strSQL & rs1("PCCode") & "','"
-
strSQL = strSQL & rs1("PBCode") & "','"
-
strSQL = strSQL & rs1("PSCCode") & "','"
-
strSQL = strSQL & strItemDesc & "','"
-
strSQL = strSQL & IIf(Len(Trim(rs1("Unit"))) = 0 Or IsNull(rs1("Unit")), " ", rs1("Unit")) & "',"
-
strSQL = strSQL & rs1("StdCost") & ","
-
strSQL = strSQL & rs1("RSP") & ","
-
strSQL = strSQL & IIf(Len(Trim(rs1("ExpectedSalesQty"))) = 0 Or IsNull(rs1("ExpectedSalesQty")), 1, rs1("ExpectedSalesQty")) & ",'"
-
strSQL = strSQL & IIf(Len(Trim(rs1("CustomCode"))) = 0 Or IsNull(rs1("CustomCode")), " ", rs1("CustomCode")) & "','"
-
strSQL = strSQL & strHQMfgCode & "',"
-
strSQL = strSQL & rs1("QtyOfUnit") & ",'"
-
strSQL = strSQL & rs1("ItemType") & "',"
-
strSQL = strSQL & rs1("MeasurementUnit") & ",'"
-
strSQL = strSQL & rs1("UnitCode") & "'"
-
strSQL = strSQL & ")"
-
db.Execute strSQL
-
-
strSQL = "UPDATE NewItem SET Updated=1 WHERE NewItemIndex=" & rs1("NewItemIndex")
-
db.Execute strSQL
-
-
strSQL = "UPDATE dbo_ChinaStk_ProdCat SET BarCodeCounter=BarCodeCounter+1 "
-
strSQL = strSQL & "WHERE PCCode='" & rs1("PCCode") & "' "
-
db.Execute strSQL
-
-
strSQL = "INSERT INTO [Outlet Item List] (HQMfgCode,UnitCost) "
-
strSQL = strSQL & "VALUES('" & strHQMfgCode & "',"
-
strSQL = strSQL & rs1("StdCost") & ")"
-
db.Execute strSQL
-
NextRec:
-
rs1.MoveNext
-
Loop
-
-
If updStatus Then
-
strSQL = "UPDATE Project_Counter SET Project_Counter = Project_Counter+1 WHERE Desc_Project='Chinastk'"
-
db.Execute strSQL
-
End If
-
-
-
Set rs1 = Nothing
-
Set rs2 = Nothing
-
Set ProjID = Nothing
-
Set db = Nothing
-
-
-
-
DoCmd.OpenQuery "qrymoveProcessesNewItem"
-
'DoCmd.OpenQuery "qryDeleteNewItem"
-
If intErrNo > 0 Then
-
MsgBox intErrNo & " record(s) cannot be process due to the invalid Product Category or Product Subcategory, please correct it!"
-
End If
-
End Function
-
-
-
1 1166
to replace " in string: this replaces: " in text1 with: _ - Text2 = Replace(Text1, """", "_")
to check the lenght of a string: - If Len(Text1) > 40 Then MsgBox "To Long"
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Bruce Rusk |
last post by:
I'm using Stephen Lebans' RTF2 control in a report, and have discovered what
may be a slight bug in it.
I have a lot of non-Western language (Chinese) text in my RTF field, and
such records get...
|
by: martin |
last post by:
Hi,
I am a web page and a web user control. My web user control is placed in my
web page using the following directive
<%@ Register TagPrefix="uc1" TagName="Header"...
|
by: Eric |
last post by:
I have built a composite user web control that I want to create dynamically.
The form will contain a variable number of these controls and as well some
of the contents of the user web control...
|
by: John Lau |
last post by:
Hi,
Is there documentation that talks about the page lifecycle, the lifecycle of
controls on the page, and the rendering of inline code, in a single
document?
Thanks,
John
|
by: serge calderara |
last post by:
Dear all,
I am new in asp.net and prepare myself for exam
I still have dificulties to understand the difference between server control
and HTML control.
Okey things whcih are clear are the fact...
|
by: Mike |
last post by:
Hi,
I am strugling with a simple problem which I can't seem to resolve.
I have an asp.net page which contains a server-control (flytreeview,
which is a kind
of a tree to be exact).
The tree is...
|
by: Rolf Welskes |
last post by:
Hello,
I have an ObjectDataSource which has as business-object a simple array of
strings. No problem.
I have an own (custom) control to which I give the DataSourceId and in the
custom-control...
|
by: rn5a |
last post by:
Assume that a user control (MyUC.ascx) encapsulates 2 TextBoxes with
the IDs 'txt1' & 'txt2' respectively. To use this user control in an
ASPX page, the following Register directive will be...
|
by: rizwanahmed24 |
last post by:
Hello
i have made a custom control. i have placed a panel on it. I want this
panel to behave just like the normal panel. The problem i was having is
that the panel on my custom control doesnt...
|
by: GaryTexmo |
last post by:
In my last insight, http://bytes.com/topic/c-sharp/insights/909141-object-scaling-varying-resolutions, I talked about scaling objects to a form's size so that it would always draw with the correct...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |