Click here to Skip to main content
15,891,033 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Help: ASP.NET Ajax client-side framework failed to load. Pin
Christian Graus17-Dec-08 17:04
protectorChristian Graus17-Dec-08 17:04 
AnswerRe: Help: ASP.NET Ajax client-side framework failed to load. Pin
Kip Smith18-Dec-08 4:11
Kip Smith18-Dec-08 4:11 
Questionhow to send and read data through serial port using visual studio 2005? Pin
vivekmenon170617-Dec-08 8:03
vivekmenon170617-Dec-08 8:03 
AnswerRe: how to send and read data through serial port using visual studio 2005? Pin
Ben Fair17-Dec-08 8:51
Ben Fair17-Dec-08 8:51 
GeneralRe: how to send and read data through serial port using visual studio 2005? Pin
Luc Pattyn17-Dec-08 8:57
sitebuilderLuc Pattyn17-Dec-08 8:57 
QuestionOOOOOOOPS!!!!! Pin
kshincsk17-Dec-08 7:58
kshincsk17-Dec-08 7:58 
GeneralRe: OOOOOOOPS!!!!! Pin
Luc Pattyn17-Dec-08 9:00
sitebuilderLuc Pattyn17-Dec-08 9:00 
QuestionMulti User Application with Access database Pin
kshincsk17-Dec-08 7:56
kshincsk17-Dec-08 7:56 
Hello experts,

I am really stumped on this one. I have a VB6 front end tool to log in customer queris and the corresponding resolutions with start and end timestamps, customer name,email, phone number etc. Each customer interation is logged into the database via the application into the database and needs to be tagged with a unique ID.

The requirement is that I need to generate the ID every time a new case is logged in the program and save the information to a temporary table first and then push it to the main table. this is ecause there are multiple users for the application and in order to avoid dupliation of the Case ID I have used the "idReturn" sub procedure to find the last updated ID and increment it to log a new case in the table.

The problem is that the new case ID does not enerate in spite of the procedure I added , because the query in subprocedure "cmdUpdate_Click()" does not update the main table form the temporary table. Easch user would run an instance of the application from his or her own systema nd according to the a parameter set from the login form, another field called "RepID" will be updated in the table whe they log a case by clicking on the "Update" Command button after which the next Case Id should be generated. i guess I am kinda looking for a Token system to make sure that when a record has been updated with a unique case ID, the next user to press the update button to log a case should e given the next new unique ID dynamically created to store in the database.

Any suggestions? Or could someone please direct me to some examples of Multi_user database programs in VB6 with similar record lock criteria?
I can send anyone the source code if they wish to analyse it further.

The database record would look like this

ID Date Month Weekday Time Originator CustName.. etc
1 27.05.2008 December Tuesday 9:00:00AM Distributor Vicky West.etc
.
.
.

Please see the code for the form below. Sorry if it is toooooo looooooong!
Option Explicit

Public strword, intplace, idlast
Dim temp As Long
Dim currID As String

Private Sub cmdAdd_Click()

    Data1.Recordset.AddNew

    Dim temp As Long

    date.Text = DateValue(Now)

    Dim m

    m = Month(Now)
    monthnam.Text = MonthName(m, False)
    weekd.Text = WeekdayName(Weekday(Now))
    time.Text = TimeValue(Now)
    starttime = Now
    orig.Text = ""
    Text1.Text = ""
    copname.Text = ""
    contactno.Text = ""
    contemail.Text = ""
    qrytype.Text = ""
    prodcode.Text = ""
    mel.Text = ""
    vendcode.Text = ""
    batchlot.Text = ""
    saleval.Text = ""
    qry.Text = ""
    answer.Text = ""
    sourcecontact.Text = ""
    status.Text = ""
    cmdAdd.Visible = False
    cmdUpdate.Enabled = True
    
End Sub

Private Sub cmdRefresh_Click()

End Sub

Private Sub cmdUpdate_Click()
       cmdUpdate.Enabled = False
    cmdAdd.Visible = True
    cmdAdd.Enabled = True

    If status.Text = "Closed" Then

        endtime = Now

    End If

    Data1.Recordset.Update
  
Dim conn As New ADODB.Connection
Dim mydb As Database
Dim qd As QueryDef
     
    Dim CONNECT_STRING As String

    CONNECT_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=\\10.192.16.21\global\uktech\db\uktech.mdb"
                
    Dim RS As Recordset

    Set RS = New Recordset
        
    'Generate a SQL
    Dim strSQL

    strSQL = "INSERT INTO main ([ID],[Date], [Month], Weekday, [Time], Originator, [First & Last Name], [Company name], [Contact No], [Contact Email], [Type of query], [Product code], MEL, [Vendor code], [Batch/Lot/Serial], [Sale value (GBP)], QUERY, ANSWER, STATUS, REPID, ContactSource, starttime, endtime, totaltime, Methcontact )"
    strSQL = strSQL & "SELECT [ID],[Date], [Month], [Weekday], [Time], [Originator], [First & Last Name], [Company name], [Contact No], [Contact Email], [Type of query], [Product code], [MEL], [Vendor code], [Batch/Lot/Serial], [Sale value (GBP)], [QUERY], [ANSWER], [STATUS], [REPID], [ContactSource], [starttime], [endtime], [totaltime], [Methcontact]"
    strSQL = strSQL & "FROM tempmain;"

    With RS
        .Open strSQL, CONNECT_STRING
                
    End With
    Set RS = NothingCall idReturn
    Call idReturn
    Call deleteTemptable

   
    
End Sub

Private Sub Command1_Click()

    Dim strSQL1 As String

    Dim key     As String

    key = Text2.Text

    'This specifies the SQL to be executed
    strSQL1 = "SELECT DISTINCT * "
    strSQL1 = strSQL1 & "FROM [qa]where QUERY LIKE '%" & key & "%'"
    'This specifies that the type of the ADODC is for SQL
    Adodc1.CommandType = adCmdText
    'This assigns the SQL result to the ADODC
    Adodc1.RecordSource = strSQL1
    Adodc1.Refresh

    'Adodc1.Recordset.Requery
    'The result from the SQL will then be used
    'to populate the datagrid
    Set DataGrid1.DataSource = Adodc1
    DataGrid1.Columns(0).Width = 7300
    DataGrid1.Columns(1).Width = 7200
    DataGrid1.AllowUpdate = False

End Sub

Private Sub Command2_Click()

    Adodc1.Recordset.AddNew
    Adodc1.Recordset(0) = qry.Text
    Adodc1.Recordset(1) = answer.Text
    Adodc1.Recordset.Update

End Sub

Private Sub Command3_Click()
    
    Form3.Show
    Unload Me
End Sub

Private Sub Form_Click()
Call idReturn
End Sub

Private Sub Form_Load()
Call idReturn
    cmdAdd_Click
    
    
    cmdAdd.Enabled = False
   
    DataGrid1.AllowUpdate = False

    DataGrid1.Columns(0).Width = 7300
    DataGrid1.Columns(0).Caption = "QUERY"

    DataGrid1.Columns(1).Width = 7300
    DataGrid1.Columns(1).Caption = "ANSWER"

End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Call idReturn

End Sub

Private Sub Option1_Click()

    methcontact.Text = "Call"

End Sub

Private Sub Option2_Click()

    methcontact.Text = "Email"

End Sub

Private Sub orig_Click()

    Combo1.Visible = True
    orig.Visible = False

End Sub

Private Sub combo1_Click()

    orig.Text = Combo1.Text
    Combo1.Visible = False
    orig.Visible = True

End Sub

Private Sub qry_GotFocus()

    strword = ""
    intplace = 0

End Sub

Private Sub qrytype_Click()

    Combo2.Visible = True
    qrytype.Visible = False

End Sub

Private Sub Combo2_click()

    qrytype.Text = Combo2.Text
    Combo2.Visible = False
    qrytype.Visible = True

End Sub

Private Sub sourcecontact_Click()

    Combo4.Visible = True
    sourcecontact.Visible = False

End Sub

Private Sub status_Click()

    Combo3.Visible = True
    status.Visible = False

    If status.Text = "Closed" Then

        endtime = Now

    End If

End Sub

Private Sub combo3_Click()

    status.Text = Combo3.Text
    Combo3.Visible = False
    status.Visible = True

End Sub

Private Sub combo4_Click()

    sourcecontact.Text = Combo4.Text

    If Combo4.Text = "Others" Then
        sourcecontact.Text = ""
        MsgBox "Please Specify The Customer's Source Of Contact Information in this Text Box", , "Contact Source Details"
        sourcecontact.SetFocus
    End If

    Combo4.Visible = False
    sourcecontact.Visible = True

End Sub

Public Sub idReturn()
    
    Dim CONNECT_STRING As String

    CONNECT_STRING = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=\\10.192.16.21\global\uktech\db\uktech.mdb"
                
    Dim RS As Recordset

    Set RS = New Recordset
        
    'Generate a SQL
    Dim strSQL As String

    strSQL = "select count(*) from main "

    With RS
        .Open strSQL, CONNECT_STRING
            
    End With

    temp = RS(0)
    id.Text = temp + 1
    RS.Requery
    RS.Close
    Set RS = Nothing
      
End Sub



Private Sub deleteTemptable()
 
    Dim conn As New ADODB.Connection
Dim mydb As Database
Dim qd As QueryDef
        
      With conn 'this reliably opens a connection
         .ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=\\10.192.16.21\global\uktech\db\uktech.mdb"
          .Open
    End With
        
      Set mydb = OpenDatabase("\\10.192.16.21\global\uktech\db\uktech.mdb")
        
    Set qd = mydb.QueryDefs("deletetemp")
        Call qd.Execute

End Sub




Thanks in advance and Best Regards,

Kumar (kshincsk@gmail.com)
AnswerRe: Multi User Application with Access database Pin
Dave Kreskowiak18-Dec-08 2:10
mveDave Kreskowiak18-Dec-08 2:10 
GeneralRe: Multi User Application with Access database Pin
kshincsk19-Dec-08 4:10
kshincsk19-Dec-08 4:10 
GeneralRe: Multi User Application with Access database Pin
Dave Kreskowiak19-Dec-08 12:08
mveDave Kreskowiak19-Dec-08 12:08 
GeneralRe: Multi User Application with Access database Pin
kshincsk22-Dec-08 1:05
kshincsk22-Dec-08 1:05 
GeneralRe: Multi User Application with Access database Pin
Dave Kreskowiak22-Dec-08 2:12
mveDave Kreskowiak22-Dec-08 2:12 
Question[Message Deleted] Pin
MS Lee17-Dec-08 4:22
MS Lee17-Dec-08 4:22 
AnswerRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
Tom Deketelaere17-Dec-08 4:52
professionalTom Deketelaere17-Dec-08 4:52 
GeneralRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
Jon_Boy17-Dec-08 6:09
Jon_Boy17-Dec-08 6:09 
AnswerRe: is it possible to import a dll file which was developed my vb.net in to a asp.net application? Pin
Paul Conrad17-Dec-08 5:44
professionalPaul Conrad17-Dec-08 5:44 
QuestionMkdir function Pin
dennymw17-Dec-08 0:18
dennymw17-Dec-08 0:18 
AnswerRe: Mkdir function Pin
Simon P Stevens17-Dec-08 0:43
Simon P Stevens17-Dec-08 0:43 
GeneralRe: Mkdir function Pin
dennymw17-Dec-08 2:09
dennymw17-Dec-08 2:09 
Question2D closet Designer Pin
willy200516-Dec-08 23:28
willy200516-Dec-08 23:28 
QuestionDebugger problem "The breakpoint will not currently be hit. No symbols have been loaded for this document Pin
~Khatri Mitesh~16-Dec-08 21:47
~Khatri Mitesh~16-Dec-08 21:47 
AnswerRe: Debugger problem "The breakpoint will not currently be hit. No symbols have been loaded for this document Pin
Simon P Stevens16-Dec-08 22:44
Simon P Stevens16-Dec-08 22:44 
GeneralRe: Debugger problem "The breakpoint will not currently be hit. No symbols have been loaded for this document Pin
astanton197817-Dec-08 3:34
astanton197817-Dec-08 3:34 
GeneralRe: Debugger problem "The breakpoint will not currently be hit. No symbols have been loaded for this document Pin
Jon_Boy17-Dec-08 4:13
Jon_Boy17-Dec-08 4:13 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.