|
Thread: Dao
-
May 4th, 2005, 11:06 PM
#1
Thread Starter
Hyperactive Member
Dao
Ok i have a combo box that is suppose to fill in the other fields.
I have got this code to fill the combobox but how do i male it fill in the other fields ????
VB Code:
Private Sub Form_Load()
Data3.Refresh
With Data3.Recordset
.MoveFirst
Do Until .EOF
cboMembershipNo.AddItem (.Fields("MembershipNumber"))
.MoveNext
Loop
End With
End Sub
that works fine, i just need to know how to make it fill in the relevant information.
-
May 4th, 2005, 11:31 PM
#2
Re: Dao
What do you mean, fill the cboMembershipNo with all the fields from Data3.recordset?
-
May 4th, 2005, 11:37 PM
#3
Thread Starter
Hyperactive Member
Re: Dao
i have resolved my first problem but i have come accoress another one.
VB Code:
Private Sub cmdDelete_Click()
On Error GoTo DataError
With Data3.Recordset
Data3.Recordset.Delete
Data3.Recordset.Fields("MembershipNumber") = cboMembershipNo.Text
Data3.Recordset.Fields("FullName") = txtName.Text
Data3.Recordset.Fields("Address") = txtAddress.Text
Data3.Recordset.Fields("DateOfBirth") = txtDateOfBirth.Text
Data3.Recordset.Fields("TelephoneNumber") = txtTelephone.Text
Data3.Recordset.Fields("OtherInfo") = txtAddInfo.Text
Data3.Refresh
End With
Exit Sub
DataError:
MsgBox Err.Description
End Sub
it doens't delete the record until i close the application completly any ideas how i get around this ??????
-
May 4th, 2005, 11:44 PM
#4
Re: Dao
Try....
VB Code:
Private Sub cmdDelete_Click()
On Error GoTo DataError
With Data3.Recordset
Data3.Recordset.Delete
[B]Data3.Refresh[/B]
Data3.Recordset.Fields("MembershipNumber") = cboMembershipNo.Text
Data3.Recordset.Fields("FullName") = txtName.Text
Data3.Recordset.Fields("Address") = txtAddress.Text
Data3.Recordset.Fields("DateOfBirth") = txtDateOfBirth.Text
Data3.Recordset.Fields("TelephoneNumber") = txtTelephone.Text
Data3.Recordset.Fields("OtherInfo") = txtAddInfo.Text
Data3.Refresh
End With
Exit Sub
DataError:
MsgBox Err.Description
End Sub
-
May 4th, 2005, 11:49 PM
#5
Thread Starter
Hyperactive Member
Re: Dao
it gave me this error.
Update or CancelUpdate without AddNew or Edit
-
May 5th, 2005, 12:33 AM
#6
Re: Dao
On what line did the error occured?
-
May 5th, 2005, 02:47 AM
#7
Re: Dao
 Originally Posted by Ricky1
i have resolved my first problem but i have come accoress another one.
VB Code:
Private Sub cmdDelete_Click()
On Error GoTo DataError
With Data3.Recordset
Data3.Recordset.Delete
[color=green]
'---- delete may work
'---- but you haven't opened the bit below for editting or adding a new record..
'---- try the next line
Data3.Recordset.AddNew
[/color]
Data3.Recordset.Fields("MembershipNumber") = cboMembershipNo.Text
Data3.Recordset.Fields("FullName") = txtName.Text
Data3.Recordset.Fields("Address") = txtAddress.Text
Data3.Recordset.Fields("DateOfBirth") = txtDateOfBirth.Text
Data3.Recordset.Fields("TelephoneNumber") = txtTelephone.Text
Data3.Recordset.Fields("OtherInfo") = txtAddInfo.Text
[color=green]
'---- Not sure if this line would be needed
Data3.Recordset.Update
[/color]
Data3.Refresh
End With
Exit Sub
DataError:
MsgBox Err.Description
End Sub
it doens't delete the record until i close the application completly any ideas how i get around this ??????
See highlighted bits above.
Feeling like a fly on the inside of a closed window (Thunk!)
If I post a lot, it is because I am bored at work! ;D Or stuck...
* Anything I post can be only my opinion. Advice etc is up to you to persue...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|