User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the Database Design section within the Web Development category of DaniWeb, a massive community of 361,911 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,608 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our Database Design advertiser:
Views: 2389 | Replies: 2
Reply
Join Date: Dec 2005
Posts: 3
Reputation: droopy420 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
droopy420 droopy420 is offline Offline
Newbie Poster

Help Database question.. Can someone help...

  #1  
Dec 2nd, 2005
Program- VB 6.0
Database- MS Access 2003

I'm build a database base on my household bills. And I have already the database connects to the program, but I am unable to get some of my functions to run correctly. These are the problems that I am having...

1. I am able to retrieve data from my "Household" database, but I can't add, delete, or update the database, without go in manually and doing so.

2. I can't retrieve data by date from my "Lookup" database.

And

3. I trying to write a code to were I am able to type in the date and the when my database retrieves it, ii will have the format (MM/dd/yyyy).

Thank in advance...
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Nov 2005
Location: Dubai,UAE
Posts: 36
Reputation: noman78 is an unknown quantity at this point 
Rep Power: 3
Solved Threads: 0
noman78's Avatar
noman78 noman78 is offline Offline
Light Poster

Re: Database question.. Can someone help...

  #2  
Dec 7th, 2005
abt ur first two points, i need to see the code u r using, are u suing access forms to retrieve and save or its some other programming language
abt third point, the default dateformat for access is mm/dd/yyyy
so db alwasy save in this format, so for this u need to save by formatting it and need to retriever by formatting as well
format(fieldname,"dd/mm/yyyy") fro retival and
format(field,"mm/dd/yyyy") for save, if u r inputting in dd/mm/yyyy
these formats for visual basic
or u can change the regional settings -->date to dd/mm/yyyy as well
Reply With Quote  
Join Date: Dec 2005
Posts: 3
Reputation: droopy420 is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
droopy420 droopy420 is offline Offline
Newbie Poster

Re: Database question.. Can someone help...

  #3  
Dec 12th, 2005
Here is what I have in code..
Hope this is helpful.




Option Explicit
Dim b_onAdd As Boolean


Dim ConStr As String
Dim Con As ADODB.Connection


Private Sub cmdAdd_Click()
b_onAdd = True
disableBtn
adoBillInfo.Recordset.AddNew
End Sub

Private Sub cmdCancel_Click()
If b_onAdd Then
b_onAdd = False
enableBtn
End If
adoBillInfo.Recordset.CancelUpdate
End Sub

Private Sub cmdDelete_Click()
Dim response As Integer
response = MsgBox("Are you sure want to delete this record?", vbOKCancel, "Delete record for" & txtCompanyName.Text)
If response = vbOK Then
adoBillInfo.Recordset.Delete
adoBillInfo.Recordset.MoveFirst
txtTotalRecords.Text = adoBillInfo.Recordset.RecordCount
End If
End Sub

Private Sub cmdUpdate_Click()
If b_onAdd Then
b_onAdd = False
enableBtn
End If
adoBillInfo.Recordset.Update
txtTotalRecords.Text = adoBillInfo.Recordset.RecordCount
End Sub



Private Sub dblBillInfo_Click()
adoBillInfo.Recordset.Bookmark = dblBillInfo.SelectedItem

End Sub

Private Sub Form_Load()
Dim StrCompanyName As String
Dim CurAmountDue As Currency
Dim CurAmountPaid As Currency
txtCompanyName.Text = StrCompanyName
'txtDateDue.Text =
'txtDatePaid.Text = dtDate
txtAmountDue.Text = CurAmountDue
txtAmountPaid.Text = CurAmountPaid

Dim CnnStr As String 'connection string
CnnStr = "Provider=Microsoft.Jet.OLEDB.4.0;User ID=admin;Data Source=C:\House.mdb;Persist Security Info=False"
'set properties for ADODC adoBillInfo
With adoBillInfo
.ConnectionString = CnnStr
.CommandType = adCmdTable 'display results from a table
.RecordSource = "House"
End With
'set properties for ADODC adoLookup
With adoLookup
.ConnectionString = CnnStr
.CommandType = adCmdTable 'display results from a table
.RecordSource = "Lookup"
'set properties for DataCombo control dbcLookup
With dbcLookup
Set .DataSource = adoBillInfo.Recordset
Set .RowSource = adoBillInfo.Recordset
.ListField = "DateDue"
.BoundColumn = "EntryID"
.DataField = "EntryID"
End With
ConStr = "Provider =Microsoft.Jet.OLEDB.4.0;" & "Data Source =C:\House.mdb"

Set Con = New ADODB.Connection 'establish a new connection
Con.ConnectionString = ConStr
'other lines of code
End With
b_onAdd = False
'txtTotalRecords.Text = House.Recordset.RecordCount
End Sub

Private Sub ConnectToDb()
ConStr = "DSN= BILLS;UID=admin;PWD=bloone"

Set Con = New ADODB.Connection 'establish a new connection
Con.ConnectionString = ConStr
'other lines of code
End Sub



Private Sub disableBtn()
cmdAdd.Enabled = False
cmdDelete.Enabled = False
End Sub

Private Sub enableBtn()
cmdAdd.Enabled = True
cmdDelete.Enabled = True
End Sub
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

DaniWeb Database Design Marketplace
Thread Tools Display Modes

Similar Threads
Other Threads in the Database Design Forum

All times are GMT -4. The time now is 9:46 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC