Click here to Skip to main content
15,885,546 members
Home / Discussions / Visual Basic
   

Visual Basic

 
AnswerRe: Chat Application Pin
Dave Kreskowiak18-May-07 4:24
mveDave Kreskowiak18-May-07 4:24 
GeneralRe: Chat Application Pin
Paul Conrad18-May-07 6:16
professionalPaul Conrad18-May-07 6:16 
GeneralRe: Chat Application Pin
leckey18-May-07 8:01
leckey18-May-07 8:01 
GeneralRe: Chat Application Pin
Paul Conrad18-May-07 10:18
professionalPaul Conrad18-May-07 10:18 
GeneralRe: Chat Application Pin
The ANZAC18-May-07 12:10
The ANZAC18-May-07 12:10 
GeneralRe: Chat Application Pin
Paul Conrad18-May-07 14:42
professionalPaul Conrad18-May-07 14:42 
GeneralRe: Read what i asked? Pin
kantipudi21-May-07 19:48
kantipudi21-May-07 19:48 
QuestionHelp me make this code to Point to SQl Server that Access localy Pin
Vimalsoft(Pty) Ltd18-May-07 3:39
professionalVimalsoft(Pty) Ltd18-May-07 3:39 
Am Sending the who code Please Rearange it for me, am taking the old one., i want it to face SQL db for class module clsClient
<br />
<br />
<br />
Dim WithEvents adoPrimaryRS As Recordset<br />
Private DoingRequery As Boolean<br />
Public Event MoveComplete()<br />
Private Sub Class_Initialize()<br />
  Dim sSQL As String<br />
  Dim db As Connection<br />
  Set db = New Connection<br />
  db.CursorLocation = adUseClient<br />
  db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Db\Valroldb.mdb;"<br />
  'sSQL = "Select Name from owner"<br />
  Set adoPrimaryRS = New Recordset<br />
  'GetOwner<br />
  'If OpenCN Then<br />
   If OpenCN Then<br />
        adoPrimaryRS.Open BuiltSQL, CN, adOpenForwardOnly, adLockOptimistic<br />
  <br />
    DataMembers.Add "Primary"<br />
  End If<br />
'db.Close<br />
'Set db = Nothing<br />
End Sub<br />
<br />
Private Sub Class_GetDataMember(DataMember As String, Data As Object)<br />
  Select Case DataMember<br />
  Case "Primary"<br />
    Set Data = adoPrimaryRS<br />
  End Select<br />
End Sub<br />
<br />
Private Sub adoPrimaryRS_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)<br />
  RaiseEvent MoveComplete<br />
End Sub<br />
<br />
Private Sub adoPrimaryRS_WillChangeRecord(ByVal adReason As ADODB.EventReasonEnum, ByVal cRecords As Long, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)<br />
  'This is where you put validation code<br />
  'This event gets called when the following actions occur<br />
  Dim bCancel As Boolean<br />
  Select Case adReason<br />
  Case adRsnAddNew<br />
  Case adRsnClose<br />
  Case adRsnDelete<br />
  Case adRsnFirstChange<br />
  Case adRsnMove<br />
  Case adRsnRequery<br />
  Case adRsnResynch<br />
  Case adRsnUndoAddNew<br />
  Case adRsnUndoDelete<br />
  Case adRsnUndoUpdate<br />
  Case adRsnUpdate<br />
  End Select<br />
<br />
  If bCancel Then adStatus = adStatusCancel<br />
End Sub<br />
<br />
Public Property Get EditingRecord() As Boolean<br />
  EditingRecord = (adoPrimaryRS.EditMode <> adEditNone)<br />
End Property<br />
<br />
Public Property Get AbsolutePosition() As Long<br />
  AbsolutePosition = adoPrimaryRS.AbsolutePosition<br />
End Property<br />
<br />
Public Sub Requery()<br />
  adoPrimaryRS.Requery<br />
  DataMemberChanged "Primary"<br />
End Sub<br />
<br />
Public Sub MoveFirst()<br />
    If Not adoPrimaryRS.EOF And adoPrimaryRS.BOF Then<br />
        adoPrimaryRS.MoveFirst<br />
    End If<br />
End Sub<br />
<br />
Public Sub MoveLast()<br />
    If Not adoPrimaryRS.EOF Or Not adoPrimaryRS.BOF Then<br />
        adoPrimaryRS.MoveLast<br />
    End If<br />
End Sub<br />
<br />
Public Sub MoveNext()<br />
  If Not adoPrimaryRS.EOF Then adoPrimaryRS.MoveNext<br />
  If adoPrimaryRS.EOF And adoPrimaryRS.RecordCount > 0 Then<br />
    Beep<br />
    'moved off the end so go back<br />
    adoPrimaryRS.MoveLast<br />
  End If<br />
End Sub<br />
<br />
Public Sub MovePrevious()<br />
  If Not adoPrimaryRS.BOF Then adoPrimaryRS.MovePrevious<br />
  If adoPrimaryRS.BOF And adoPrimaryRS.RecordCount > 0 Then<br />
    Beep<br />
    'moved off the end so go back<br />
    adoPrimaryRS.MoveFirst<br />
  End If<br />
End Sub<br />
<br />


i want it to Point to

PROVIDER=SQLOLEDB
Server=sgiicornetgs01Userid=sde
Password=topology
Database=Tshwane_Valuations
Table:Property
and the Following is the Double click event of the datagrid
<br />
Private Sub datagrid1_DblClick()<br />
Dim sSQL As String<br />
Dim rS As New ADODB.Recordset<br />
'Dim con As Object<br />
'Set con = Application.CurrentProject.Connection<br />
iClientId = datagrid1.Columns(0)<br />
sSQL = "SELECT Client.ClientID, Client.ClientCode, Client.Name"<br />
sSQL = sSQL & ",Client.ContactPerson, Client.Address, Client.Telephone"<br />
sSQL = sSQL & ", Client.[E-Mail] as e_mail,CellNo"<br />
sSQL = sSQL & " From Client"<br />
sSQL = sSQL & " Where CLientId = " & iClientId<br />
<br />
If OpenCN Then<br />
    rS.Open sSQL, CN, adOpenForwardOnly, adLockReadOnly<br />
    If Not rS.EOF Then<br />
        cmdClear.Value = True<br />
        Me.txtLCLientName = rS("Name")<br />
        Me.txtClientCode = rS("ClientCode")<br />
        Me.txtContactPerson = rS("ContactPerson")<br />
        If Not IsNull(rS("Address")) Then Me.txtAddress = rS("Address")<br />
        Me.txtTelephone = rS("Telephone")<br />
        If Not IsNull(rS("e_mail")) Then Me.txtEMail = rS("e_mail")<br />
        If Not IsNull(rS("CellNo")) Then txtCell = rS("CellNo")<br />
        SSTab1.Tab = 1<br />
        cmdAdd.Caption = "&Update"<br />
        rS.Close<br />
        sSQL = "SELECT SysID,ClientId,SyslookupID,Systext1,systext2"<br />
        sSQL = sSQL & ", Other, SysVal1, SysVal2, SysVal3, Serial"<br />
        sSQL = sSQL & " FROM SysSetting"<br />
        sSQL = sSQL & " Where SyslookupID = " & 1<br />
        sSQL = sSQL & " And ClientId = " & iClientId<br />
        rS.Open sSQL, CN, adOpenDynamic, adLockOptimistic<br />
        If Not rS.EOF Then<br />
            If rS("Other") = 0 Then<br />
                Me.optInActive = True<br />
            Else<br />
                Me.optActive = True<br />
            End If<br />
            If rS("SysVal1") = 0 Then<br />
                Me.optSingle.Value = True<br />
            Else<br />
                Me.optMulti.Value = True<br />
            End If<br />
            If rS("systext2") = "0" Then<br />
                Me.cmbcdstiff.ListIndex = 0<br />
            Else<br />
                Me.cmbcdstiff.ListIndex = 1<br />
            End If<br />
            txtDate = Format(rS("systext1"), "dd/mm/yyyy")<br />
            Me.txtUsers = rS("sysval2")<br />
            Me.txtNoKeys = rS("sysVal3")<br />
            GetHistory iClientId<br />
        End If<br />
    End If<br />
End If<br />
rS.Close<br />
Set rS = Nothing<br />
End Sub<br />
Private Sub datagrid1_RowColChange(LastRow As Variant, ByVal LastCol As Integer)<br />
Dim sSQL As String<br />
Dim rS As New ADODB.Recordset<br />
'Dim con As Object<br />
'Set con = Application.CurrentProject.Connection<br />
If datagrid1.Columns(0) > "" Then<br />
    iClientId = datagrid1.Columns(0)<br />
    sSQL = "SELECT Client.ClientID, Client.ClientCode, Client.Name"<br />
    sSQL = sSQL & ",Client.ContactPerson, Client.Address, Client.Telephone"<br />
    sSQL = sSQL & ", Client.[E-Mail] as e_mail,CellNo"<br />
    sSQL = sSQL & " From Client"<br />
    sSQL = sSQL & " Where CLientId = " & iClientId<br />
    <br />
    If OpenCN Then<br />
        rS.Open sSQL, CN, adOpenForwardOnly, adLockReadOnly<br />
        If Not rS.EOF Then<br />
            cmdClear.Value = True<br />
            Me.txtLCLientName = rS("Name")<br />
            Me.txtClientCode = rS("ClientCode")<br />
            Me.txtContactPerson = rS("ContactPerson")<br />
            If Not IsNull(rS("Address")) Then Me.txtAddress = rS("Address")<br />
            If Not IsNull(rS("Telephone")) Then Me.txtTelephone = rS("Telephone")<br />
            'MaskEdBox1 = rS("Telephone")<br />
            If Not IsNull(rS("e_mail")) Then Me.txtEMail = rS("e_mail")<br />
            If Not IsNull(rS("CellNo")) Then txtCell = rS("CellNo")<br />
            SSTab1.Tab = 1<br />
            cmdAdd.Caption = "&Update"<br />
            rS.Close<br />
            sSQL = "SELECT SysID,ClientId,SyslookupID,Systext1,systext2"<br />
            sSQL = sSQL & ", Other, SysVal1, SysVal2, SysVal3, Serial"<br />
            sSQL = sSQL & " FROM SysSetting"<br />
            sSQL = sSQL & " Where SyslookupID = " & 1<br />
            sSQL = sSQL & " And ClientId = " & iClientId<br />
            rS.Open sSQL, CN, adOpenDynamic, adLockOptimistic<br />
            If Not rS.EOF Then<br />
                If rS("Other") = 0 Then<br />
                    Me.optInActive = True<br />
                Else<br />
                    Me.optActive = True<br />
                End If<br />
                If rS("SysVal1") = 0 Then<br />
                    Me.optSingle.Value = True<br />
                Else<br />
                    Me.optMulti.Value = True<br />
                End If<br />
                If rS("systext2") = "0" Then<br />
                    Me.cmbcdstiff.ListIndex = 0<br />
                Else<br />
                    Me.cmbcdstiff.ListIndex = 1<br />
                End If<br />
                txtDate = Format(rS("systext1"), "dd/mm/yyyy")<br />
                Me.txtUsers = rS("sysval2")<br />
                Me.txtNoKeys = rS("sysVal3")<br />
                GetHistory iClientId<br />
            End If<br />
        End If<br />
    End If<br />
    rS.Close<br />
    Set rS = Nothing<br />
End If<br />
End Sub<br />
<br />
Private Sub Form_Load()<br />
'cmbsurburb.RowSource = ""<br />
'cmbsurburb.Requery<br />
txtName = ""<br />
txtDate = Format(Date, "dd/mm/yyyy")<br />
Me.FillSearchCombo<br />
SSTab1.Tab = 0<br />
<br />
End Sub<br />
Private Sub Form_Resize()<br />
  On Error Resume Next<br />
  'This will resize the grid when the form is resized<br />
  grdDataGrid.Height = Me.ScaleHeight - 30 - picButtons.Height - picStatBox.Height<br />
  'lblStatus.Width = Me.Width - 1500<br />
  'cmdNext.Left = lblStatus.Width + 700<br />
  'cmdLast.Left = cmdNext.Left + 340<br />
End Sub<br />
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)<br />
  If mbEditFlag Or mbAddNewFlag Then Exit Sub<br />
<br />
  Select Case KeyCode<br />
    Case vbKeyEscape<br />
      cmdClose_Click<br />
    Case vbKeyEnd<br />
      cmdLast_Click<br />
    Case vbKeyHome<br />
      cmdFirst_Click<br />
    Case vbKeyUp, vbKeyPageUp<br />
      If Shift = vbCtrlMask Then<br />
        cmdFirst_Click<br />
      Else<br />
        cmdPrevious_Click<br />
      End If<br />
    Case vbKeyDown, vbKeyPageDown<br />
      If Shift = vbCtrlMask Then<br />
        cmdLast_Click<br />
      Else<br />
        cmdNext_Click<br />
      End If<br />
  End Select<br />
End Sub


Is the Following the right way to Go if i want to save data into the table, because what it does, it update the first record on the table ,on the fields i have supplied.
<br />
Private Sub cmdAdd_Click()<br />
rrs("Num_key") = txtnumkey<br />
rrs("EXTENSION") = txtextension<br />
rrs("Actual_Extent") = txtactualextent<br />
rrs("Lis_key") = txtliskey<br />
rrs("Func_Key") = txtfunckey<br />
rrs("Prop_Category_ID") = txtcategory<br />
rrs("GEOCODE") = txtgeocode<br />
rrs("Add_Date") = txtadddate<br />
rrs("Add_user_ID") = txtadduserid<br />
rrs.Update<br />
cmdNew.Visible = True<br />
cmdUpdate.Visible = True<br />
cmdRefresh.Visible = True<br />
cmdDelete.Visible = True<br />
               <br />
End Sub



Lastly this is my SQl Procedure that accept values, inseat the values to be inserted as new record, it update existing first record. in my table there are no update triggers.
<br />
Create Procedure prcInserting (@Num_key varchar(10),@Extension int,@Cell_ID int,<br />
@Actual_Extent float,@Lis_key varchar(50), @Func_key varchar(8),@GeoCode varchar(15))<br />
<br />
with recompile <br />
as<br />
insert into Property(Num_key,Extension,Cell_ID,Actual_Extent,Lis_key,Func_key,Active,Add_date,Add_User_ID,Spatial_ADD_Date,Rateable,Non_Discreet_Valid,Geocode)<br />
values (@Num_key,@Extension,@Cell_ID,@Actual_Extent,@Lis_key, @Func_key,0,getdate(),1,getdate(),0,0,@GeoCode)<br />
<br />


Please Help


Vuyiswa

AnswerRe: Help me make this code to Point to SQl Server that Access localy Pin
Dave Kreskowiak18-May-07 4:20
mveDave Kreskowiak18-May-07 4:20 
QuestionProblems add a new record to a DataSet using the BindingNavigator Control Pin
Quecumber25618-May-07 3:11
Quecumber25618-May-07 3:11 
AnswerRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Marcus J. Smith18-May-07 4:36
professionalMarcus J. Smith18-May-07 4:36 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Quecumber25618-May-07 5:13
Quecumber25618-May-07 5:13 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Marcus J. Smith18-May-07 5:32
professionalMarcus J. Smith18-May-07 5:32 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Quecumber25618-May-07 6:22
Quecumber25618-May-07 6:22 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Marcus J. Smith18-May-07 7:20
professionalMarcus J. Smith18-May-07 7:20 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Quecumber25618-May-07 7:34
Quecumber25618-May-07 7:34 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Marcus J. Smith18-May-07 8:10
professionalMarcus J. Smith18-May-07 8:10 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Quecumber25618-May-07 8:47
Quecumber25618-May-07 8:47 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Marcus J. Smith18-May-07 9:53
professionalMarcus J. Smith18-May-07 9:53 
GeneralRe: Problems add a new record to a DataSet using the BindingNavigator Control Pin
Quecumber25618-May-07 10:14
Quecumber25618-May-07 10:14 
Questioncreating stles for windows form controls Pin
MartyK200718-May-07 2:26
MartyK200718-May-07 2:26 
AnswerRe: creating stles for windows form controls Pin
Christian Graus18-May-07 3:04
protectorChristian Graus18-May-07 3:04 
GeneralRe: creating stles for windows form controls Pin
MartyK200718-May-07 3:06
MartyK200718-May-07 3:06 
QuestionHow to paste to the default mail client Pin
triley125818-May-07 1:08
triley125818-May-07 1:08 
AnswerRe: How to paste to the default mail client Pin
Xandip18-May-07 1:58
Xandip18-May-07 1:58 

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.